summary refs log tree commit diff stats
path: root/tests/arc/tconst_to_sink.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arc/tconst_to_sink.nim')
-rw-r--r--tests/arc/tconst_to_sink.nim26
1 files changed, 26 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..25f659341
--- /dev/null
+++ b/tests/arc/tconst_to_sink.nim
@@ -0,0 +1,26 @@
+discard """
+  output: '''@[(s1: "333", s2: ""), (s1: "abc", s2: "def"), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "3x", s2: ""), (s1: "lastone", s2: "")]'''
+  matrix: "--gc:arc"
+  targets: "c cpp"
+"""
+
+# 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