This commit is contained in:
Araq 2019-04-17 17:26:59 +02:00
commit 7640a230fc
3 changed files with 34 additions and 7 deletions

View file

@ -651,6 +651,8 @@ proc transformFor(c: PTransf, n: PNode): PTransNode =
var t = formal.typ
if formal.ast != nil and formal.ast.typ.destructor != nil and t.destructor == nil:
t = formal.ast.typ # better use the type that actually has a destructor.
elif t.destructor == nil and arg.typ.destructor != nil:
t = arg.typ
# generate a temporary and produce an assignment statement:
var temp = newTemp(c, t, formal.info)
#temp.sym.flags.incl sfCursor