This commit is contained in:
Yuriy Glukhov
2015-08-06 22:19:33 +03:00
parent 14ce3c7d4d
commit 41a2a9f00b

View File

@@ -2260,7 +2260,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
result = semStaticStmt(c, n)
of nkDefer:
n.sons[0] = semExpr(c, n.sons[0])
if not n.sons[0].typ.isEmptyType:
if not n.sons[0].typ.isEmptyType and not implicitlyDiscardable(n.sons[0]):
localError(n.info, errGenerated, "'defer' takes a 'void' expression")
#localError(n.info, errGenerated, "'defer' not allowed in this context")
else: