summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAudun Wilhelmsen <skyfex@gmail.com>2015-01-16 22:31:43 +0100
committerAudun Wilhelmsen <skyfex@gmail.com>2015-01-16 22:31:43 +0100
commitf25c47db1ae7659785ef59964e353304dc5b01ee (patch)
tree9136bd016373ee33baac24e053b02bd111c7b531
parentc7934be7e845a01275d4e1ede5515ef5f98cc2c2 (diff)
downloadNim-f25c47db1ae7659785ef59964e353304dc5b01ee.tar.gz
Add test for issue #1946
-rw-r--r--tests/vm/tldconst.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/vm/tldconst.nim b/tests/vm/tldconst.nim
new file mode 100644
index 000000000..9eabb7525
--- /dev/null
+++ b/tests/vm/tldconst.nim
@@ -0,0 +1,14 @@
+# Passes if it compiles
+# From issue #1946
+
+type
+  Part = object
+    index: int ## array index of argument to be accessed
+
+proc foobar(): int =
+    var x: Part
+    if x.index < high(int):
+        discard
+    0
+
+const x = foobar()
\ No newline at end of file