This commit is contained in:
Andreas Rumpf
2016-05-31 20:35:51 +02:00
parent 65c95e01e4
commit 660cd7ed70

View File

@@ -17,7 +17,8 @@ proc semDiscard(c: PContext, n: PNode): PNode =
checkSonsLen(n, 1)
if n.sons[0].kind != nkEmpty:
n.sons[0] = semExprWithType(c, n.sons[0])
if isEmptyType(n.sons[0].typ): localError(n.info, errInvalidDiscard)
if isEmptyType(n.sons[0].typ) or n.sons[0].typ.kind == tyNone:
localError(n.info, errInvalidDiscard)
proc semBreakOrContinue(c: PContext, n: PNode): PNode =
result = n