mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
@@ -2357,8 +2357,11 @@ proc genMove(p: BProc; n: PNode; d: var TLoc) =
|
||||
linefmt(p, cpsStmts, "}$n$1.len = $2.len; $1.p = $2.p;$n", [rdLoc(a), rdLoc(src)])
|
||||
else:
|
||||
if d.k == locNone: getTemp(p, n.typ, d)
|
||||
genAssignment(p, d, a, {})
|
||||
if p.config.selectedGC notin {gcArc, gcAtomicArc, gcOrc}:
|
||||
if p.config.selectedGC in {gcArc, gcAtomicArc, gcOrc}:
|
||||
genAssignment(p, d, a, {})
|
||||
else:
|
||||
let flags = if not canMove(p, n[1], d): {needToCopy} else: {}
|
||||
genAssignment(p, d, a, flags)
|
||||
resetLoc(p, a)
|
||||
|
||||
proc genDestroy(p: BProc; n: PNode) =
|
||||
|
||||
@@ -27,3 +27,15 @@ block: # bug #17812
|
||||
proc `$`(o: MyObj): string = o.repr
|
||||
|
||||
doAssert ($MyObj()).len > 0
|
||||
|
||||
# bug #22175
|
||||
|
||||
type Xxx = object
|
||||
value: string
|
||||
|
||||
proc complete(xxx: ref Xxx, v: sink string) =
|
||||
xxx.value = move(v)
|
||||
|
||||
let yyy = (ref Xxx)()
|
||||
|
||||
yyy.complete("test")
|
||||
|
||||
Reference in New Issue
Block a user