parent
7481f43753
commit
c87796180e
2 changed files with 20 additions and 3 deletions
|
|
@ -93,8 +93,8 @@ proc fillBodyObj(c: var TLiftCtx; n, body, x, y: PNode; enforceDefaultOp: bool)
|
||||||
# XXX This is only correct for 'attachedSink'!
|
# XXX This is only correct for 'attachedSink'!
|
||||||
var localEnforceDefaultOp = enforceDefaultOp
|
var localEnforceDefaultOp = enforceDefaultOp
|
||||||
if c.kind == attachedSink:
|
if c.kind == attachedSink:
|
||||||
## the value needs to be destroyed before we assign the selector
|
# the value needs to be destroyed before we assign the selector
|
||||||
## or the value is lost
|
# or the value is lost
|
||||||
let prevKind = c.kind
|
let prevKind = c.kind
|
||||||
c.kind = attachedDestructor
|
c.kind = attachedDestructor
|
||||||
fillBodyObj(c, n, body, x, y, enforceDefaultOp = false)
|
fillBodyObj(c, n, body, x, y, enforceDefaultOp = false)
|
||||||
|
|
@ -704,7 +704,10 @@ proc fillBody(c: var TLiftCtx; t: PType; body, x, y: PNode) =
|
||||||
defaultOp(c, t, body, x, y)
|
defaultOp(c, t, body, x, y)
|
||||||
of tyObject:
|
of tyObject:
|
||||||
if not considerUserDefinedOp(c, t, body, x, y):
|
if not considerUserDefinedOp(c, t, body, x, y):
|
||||||
fillBodyObjT(c, t, body, x, y)
|
if c.kind in {attachedAsgn, attachedSink} and t.sym != nil and sfImportc in t.sym.flags:
|
||||||
|
body.add newAsgnStmt(x, y)
|
||||||
|
else:
|
||||||
|
fillBodyObjT(c, t, body, x, y)
|
||||||
of tyDistinct:
|
of tyDistinct:
|
||||||
if not considerUserDefinedOp(c, t, body, x, y):
|
if not considerUserDefinedOp(c, t, body, x, y):
|
||||||
fillBody(c, t[0], body, x, y)
|
fillBody(c, t[0], body, x, y)
|
||||||
|
|
|
||||||
14
tests/arc/timportedobj.nim
Normal file
14
tests/arc/timportedobj.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
discard """
|
||||||
|
cmd: "nim c --gc:arc $file"
|
||||||
|
action: "compile"
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #13269
|
||||||
|
|
||||||
|
import posix
|
||||||
|
proc foo*() =
|
||||||
|
var last = newSeq[Stat]()
|
||||||
|
var next = last
|
||||||
|
for i in 0..3:
|
||||||
|
last = next
|
||||||
|
foo()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue