mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
fixes #25167
(cherry picked from commit fed0053481)
This commit is contained in:
@@ -834,7 +834,9 @@ proc transformFor(c: PTransf, n: PNode): PNode =
|
||||
var temp = newTemp(c, arg[0].typ, formal.info)
|
||||
addVar(v, temp)
|
||||
stmtList.add(newAsgnStmt(c, nkFastAsgn, temp, arg[0], true))
|
||||
newC.mapping[formal.itemId] = newDeref(temp)
|
||||
let newD = newDeref(temp)
|
||||
newD.typ() = t
|
||||
newC.mapping[formal.itemId] = newD
|
||||
else:
|
||||
# generate a temporary and produce an assignment statement:
|
||||
var temp = newTemp(c, t, formal.info)
|
||||
|
||||
@@ -424,3 +424,11 @@ block: # bug #25121
|
||||
for _ in k():
|
||||
(proc() = (; let _ = block: 0))()
|
||||
|
||||
let aaa = new array[1000, byte]
|
||||
block:
|
||||
for _ in cast[typeof(aaa)](aaa)[]:
|
||||
discard
|
||||
block:
|
||||
let x = cast[typeof(aaa)](aaa) # not even var
|
||||
for _ in x[]:
|
||||
discard
|
||||
|
||||
Reference in New Issue
Block a user