We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cfdac66 commit 00ce35fCopy full SHA for 00ce35f
compiler/varpartitions.nim
@@ -479,7 +479,7 @@ proc destMightOwn(c: var Partitions; dest: var VarIndex; n: PNode) =
479
# calls do construct, what we construct must be destroyed,
480
# so dest cannot be a cursor:
481
dest.flags.incl ownsData
482
- elif n.typ.kind in {tyLent, tyVar}:
+ elif n.typ.kind in {tyLent, tyVar} and n.len > 1:
483
# we know the result is derived from the first argument:
484
var roots: seq[(PSym, int)]
485
allRoots(n[1], roots, RootEscapes)
tests/arc/t18971.nim
@@ -0,0 +1,10 @@
1
+discard """
2
+ cmd: "nim c --gc:arc $file"
3
+"""
4
+
5
+type MyObj = ref object
6
7
+var o = MyObj()
8
+proc x: var MyObj = o
9
10
+var o2 = x()
0 commit comments