summary refs log tree commit diff stats
path: root/tests/arc
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-12-09 22:23:16 +0100
committerGitHub <noreply@github.com>2021-12-09 22:23:16 +0100
commit32d4bf352585a4fc4a6fa1bd24b270af087b0372 (patch)
tree08734806f2cbd145350290205deb1cfe5b8820bc /tests/arc
parent4f64c9fae5e46d73d226f7d5b86d518d034be7b3 (diff)
downloadNim-32d4bf352585a4fc4a6fa1bd24b270af087b0372.tar.gz
fixes an old ARC bug: the produced copy/sink operations don't copy the hidden type field for objects with enabled inheritance; fixes #19205 [backport:1.6] (#19232)
Diffstat (limited to 'tests/arc')
-rw-r--r--tests/arc/tarcmisc.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim
index d259e1197..45d1514cd 100644
--- a/tests/arc/tarcmisc.nim
+++ b/tests/arc/tarcmisc.nim
@@ -30,6 +30,7 @@ ok
 true
 copying
 123
+42
 closed
 destroying variable: 20
 destroying variable: 10
@@ -482,3 +483,17 @@ method testMethod(self: BrokenObject) {.base.} =
 
 let mikasa = BrokenObject()
 mikasa.testMethod()
+
+# bug #19205
+type
+  InputSectionBase* = object of RootObj
+    relocations*: seq[int]   # traced reference. string has a similar SIGSEGV.
+  InputSection* = object of InputSectionBase
+
+proc fooz(sec: var InputSectionBase) =
+  if sec of InputSection:  # this line SIGSEGV.
+    echo 42
+
+var sec = create(InputSection)
+sec[] = InputSection(relocations: newSeq[int]())
+fooz sec[]