summary refs log tree commit diff stats
path: root/tests/ccgbugs/taddhigh.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ccgbugs/taddhigh.nim')
-rw-r--r--tests/ccgbugs/taddhigh.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ccgbugs/taddhigh.nim b/tests/ccgbugs/taddhigh.nim
new file mode 100644
index 000000000..d6ac8f650
--- /dev/null
+++ b/tests/ccgbugs/taddhigh.nim
@@ -0,0 +1,16 @@
+discard """
+  output: '''@[5, 5, 5]'''
+"""
+
+# bug #1832
+
+var s = @[5]
+
+# Works fine:
+let x = s[s.high]
+s.add x
+
+# Causes the 0 to appear:
+s.add s[s.high]
+
+echo s # @[5, 5, 0]