This commit is contained in:
Zahary Karadjov 2017-10-06 16:36:26 +03:00 • committed by Araq
commit 2ceee884fe
3 changed files with 27 additions and 2 deletions

View file

@ -683,9 +683,10 @@ proc genDeref(p: BProc, e: PNode, d: var TLoc; enforceDeref=false) =
d.storage = OnHeap
else:
var a: TLoc
var typ = skipTypes(e.sons[0].typ, abstractInst)
var typ = e.sons[0].typ
if typ.kind in {tyUserTypeClass, tyUserTypeClassInst} and typ.isResolvedUserTypeClass:
typ = typ.lastSon
typ = typ.skipTypes(abstractInst)
if typ.kind == tyVar and tfVarIsPtr notin typ.flags and p.module.compileToCpp and e.sons[0].kind == nkHiddenAddr:
initLocExprSingleUse(p, e[0][0], d)
return