From 25fd9e3c89108026be74136a61eff0a7e7a67ff9 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Wed, 10 Aug 2016 11:13:49 +0200 Subject: don't allow to pass a closure to spawn --- compiler/lowerings.nim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compiler') diff --git a/compiler/lowerings.nim b/compiler/lowerings.nim index cdea2a4ff..36eb24653 100644 --- a/compiler/lowerings.nim +++ b/compiler/lowerings.nim @@ -578,6 +578,8 @@ proc wrapProcForSpawn*(owner: PSym; spawnExpr: PNode; retType: PType; var fn = n.sons[0] # templates and macros are in fact valid here due to the nature of # the transformation: + if fn.kind == nkClosure: + localError(n.info, "closure in spawn environment is not allowed") if not (fn.kind == nkSym and fn.sym.kind in {skProc, skTemplate, skMacro, skMethod, skConverter}): # for indirect calls we pass the function pointer in the scratchObj -- cgit 1.4.1-2-gfad0