summary refs log tree commit diff stats
path: root/tests/ccgbugs/taddhigh.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-07-23 17:18:36 +0200
committerAraq <rumpf_a@web.de>2015-07-24 01:04:45 +0200
commit49324157421d138c3cba39b629bdb88a5b88dc54 (patch)
tree4902d16bcb4f898a779557decb41b36791dcfb90 /tests/ccgbugs/taddhigh.nim
parent18823a315e5a32d125a631f8ac8710be6102a95e (diff)
downloadNim-49324157421d138c3cba39b629bdb88a5b88dc54.tar.gz
fixes #1832
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]