Extend the fix for #11018 to strings (#11031)

* Extend the fix for #11018 to strings

* Fix testcase
This commit is contained in:
Clyybber 2019-04-15 17:06:31 +02:00 • committed by Andreas Rumpf
commit 2f56dd6b2b
2 changed files with 10 additions and 2 deletions

View file

@ -1839,7 +1839,7 @@ proc genSomeCast(p: BProc, e: PNode, d: var TLoc) =
if srcTyp.kind in {tyPtr, tyPointer} and etyp.kind in IntegralTypes:
putIntoDest(p, d, e, "(($1) (ptrdiff_t) ($2))" %
[getTypeDesc(p.module, e.typ), rdCharLoc(a)], a.storage)
elif p.config.selectedGc == gcDestructors and etyp.kind == tySequence:
elif p.config.selectedGc == gcDestructors and etyp.kind in {tySequence, tyString}:
putIntoDest(p, d, e, "(*($1*) (&$2))" %
[getTypeDesc(p.module, e.typ), rdCharLoc(a)], a.storage)
else: