From 41a2a9f00bd7e823223ce4b0830d6c9d8d6bc294 Mon Sep 17 00:00:00 2001 From: Yuriy Glukhov Date: Thu, 6 Aug 2015 22:19:33 +0300 Subject: [PATCH] Fixes #3185 --- compiler/semexprs.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index af6919d972..0e9b9ae5f1 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -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: