diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index e8c6661306..5cb4a00af1 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -991,7 +991,7 @@ proc genAddr(p: BProc, e: PNode, d: var TLoc) = else: let ssoStrSub = p.config.isDefined("nimsso") and e[0].kind == nkBracketExpr and e[0][0].typ.skipTypes(abstractVar).kind == tyString - var a: TLoc = initLocExpr(p, e[0], if ssoStrSub: {lfEnforceDeref} else: {}) + var a: TLoc = initLocExpr(p, e[0], if ssoStrSub: {lfEnforceDeref, lfPrepareForMutation} else: {}) if e[0].kind in {nkHiddenStdConv, nkHiddenSubConv, nkConv} and not ignoreConv(e[0]): # addr (conv x) introduces a temp because `conv x` is not a rvalue # transform addr ( conv ( x ) ) -> conv ( addr ( x ) ) @@ -2809,7 +2809,7 @@ proc genWasMoved(p: BProc; n: PNode) = # [addrLoc(p.config, a), getTypeDesc(p.module, a.t)]) proc genMove(p: BProc; n: PNode; d: var TLoc) = - var a: TLoc = initLocExpr(p, n[1].skipAddr, {lfEnforceDeref}) + var a: TLoc = initLocExpr(p, n[1].skipAddr, {lfEnforceDeref, lfPrepareForMutation}) if n.len == 4: # generated by liftdestructors: var src: TLoc = initLocExpr(p, n[2])