fixes #15038 [backport:1.2]

This commit is contained in:
Andreas Rumpf 2020-07-25 22:29:45 +02:00
commit aae998feff
3 changed files with 29 additions and 46 deletions

View file

@ -840,6 +840,8 @@ proc track(tracked: PEffects, n: PNode) =
useVar(tracked, n)
if n.sym.typ != nil and tfHasAsgn in n.sym.typ.flags:
tracked.owner.flags.incl sfInjectDestructors
# bug #15038: ensure consistency
if not hasDestructor(n.typ): n.typ = n.sym.typ
of nkHiddenAddr, nkAddr:
if n[0].kind == nkSym and isLocalVar(tracked, n[0].sym):
useVarNoInitCheck(tracked, n[0], n[0].sym)