This commit is contained in:
Andreas Rumpf
2016-08-09 14:16:13 +02:00
parent f1092512e3
commit 440ed8eb68
2 changed files with 16 additions and 0 deletions

View File

@@ -1980,6 +1980,9 @@ proc exprComplexConst(p: BProc, n: PNode, d: var TLoc) =
fillLoc(d, locData, t, tmp, OnStatic)
else:
putDataIntoDest(p, d, t, tmp)
# This fixes bug #4551, but we really need better dataflow
# analysis to make this 100% safe.
d.s = OnStatic
proc expr(p: BProc, n: PNode, d: var TLoc) =
case n.kind

View File

@@ -0,0 +1,13 @@
discard """
output: '''hi'''
"""
# bug #4551
proc foo() =
let arr = ["hi"]
for i, v in arr:
let bar = proc =
echo v
bar()
foo()