This commit is contained in:
ringabout
2026-02-18 20:49:54 +08:00
parent 0693e0207f
commit d15888d923
2 changed files with 11 additions and 3 deletions

View File

@@ -945,9 +945,6 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var IntSet, pos: var int,
n[^1] = firstRange(c.config, typ)
hasDefaultField = true
propagateToOwner(rectype, typ)
if typ != nil and typ.kind == tyVoid:
localError(c.config, n.info, "'void' is not allowed as a field type")
typ = errorType(c)
var fieldOwner = if c.inGenericContext > 0: c.getCurrOwner
else: rectype.sym
for i in 0..<n.len-2:

11
tests/errmsgs/t25508.nim Normal file
View File

@@ -0,0 +1,11 @@
discard """
cmd: "nim check --hints:off $file"
action: "reject"
nimout: '''
t25508.nim(10, 23) Error: 'void' is not allowed as a field type
t25508.nim(11, 18) Error: 'void' is not allowed as a field type
'''
"""
discard default(tuple[b: void])
discard default((void,))