summary refs log tree commit diff stats
path: root/compiler/semexprs.nim
diff options
context:
space:
mode:
authorYuriy Glukhov <yuriy.glukhov@gmail.com>2015-08-06 22:19:33 +0300
committerYuriy Glukhov <yuriy.glukhov@gmail.com>2015-08-06 22:19:33 +0300
commit41a2a9f00bd7e823223ce4b0830d6c9d8d6bc294 (patch)
tree18f1ec7243d95d8985c2348f5adf512a4280c84a /compiler/semexprs.nim
parent14ce3c7d4df4333a592c3b1c26fc89e8193fc3e3 (diff)
downloadNim-41a2a9f00bd7e823223ce4b0830d6c9d8d6bc294.tar.gz
Fixes #3185
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r--compiler/semexprs.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index af6919d97..0e9b9ae5f 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: