diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index c6ed5e77dc..62b63eb891 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -528,7 +528,10 @@ proc semAnonTuple(c: PContext, n: PNode, prev: PType): PType = result = newOrPrevType(tyTuple, prev, c) for it in n: let t = semTypeNode(c, it, nil) - addSonSkipIntLitChecked(c, result, t, it, c.idgen) + if t != nil and t.kind == tyVoid: + localError(c.config, it.info, "'void' is not allowed as a field type") + else: + addSonSkipIntLitChecked(c, result, t, it, c.idgen) proc firstRange(config: ConfigRef, t: PType): PNode = if t.skipModifier().kind in tyFloat..tyFloat64: @@ -565,6 +568,9 @@ proc semTuple(c: PContext, n: PNode, prev: PType): PType = else: localError(c.config, a.info, errTypeExpected) typ = errorType(c) + if typ != nil and typ.kind == tyVoid: + localError(c.config, a.info, "'void' is not allowed as a field type") + typ = errorType(c) for j in 0.. 0: c.getCurrOwner else: rectype.sym for i in 0..