summary refs log tree commit diff stats
path: root/tests/arc
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2020-03-10 11:10:52 +0100
committerAndreas Rumpf <rumpf_a@web.de>2020-03-11 09:26:57 +0100
commit60f8fdcdabf99ae60f7a743cfd682bd7c320408b (patch)
treeaf457daf9cf81c08b550b38654fbc6d422fbc5bb /tests/arc
parent861a5340fec22cbca014bffc84f61536a5aa3e37 (diff)
downloadNim-60f8fdcdabf99ae60f7a743cfd682bd7c320408b.tar.gz
fixes #13240
Diffstat (limited to 'tests/arc')
-rw-r--r--tests/arc/tconst_to_sink.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/arc/tconst_to_sink.nim b/tests/arc/tconst_to_sink.nim
new file mode 100644
index 000000000..ddcc46e67
--- /dev/null
+++ b/tests/arc/tconst_to_sink.nim
@@ -0,0 +1,25 @@
+discard """
+  output: '''@[(s1: "333", s2: ""), (s1: "abc", s2: "def"), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "lastone", s2: "")]'''
+  cmd: "nim c --gc:arc $file"
+"""
+
+# bug #13240
+
+type
+  Thing = object
+    s1: string
+    s2: string
+
+var box: seq[Thing]
+
+const c = [Thing(s1: "333"), Thing(s1: "abc", s2: "def")]
+
+for i in 0..high(c):
+  box.add c[i]
+
+for i in 0..3:
+  box.add Thing(s1: "3x")
+
+box.add Thing(s1: "lastone")
+
+echo box