summary refs log tree commit diff stats
path: root/tests/range/toutofrangevarconv.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/range/toutofrangevarconv.nim')
-rw-r--r--tests/range/toutofrangevarconv.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/range/toutofrangevarconv.nim b/tests/range/toutofrangevarconv.nim
new file mode 100644
index 000000000..1ee4d340e
--- /dev/null
+++ b/tests/range/toutofrangevarconv.nim
@@ -0,0 +1,14 @@
+discard """
+  outputsub: "value out of range: 5 notin 0 .. 3 [RangeDefect]"
+  exitcode: "1"
+"""
+
+# make sure out of bounds range conversion is detected for `var` conversions
+
+type R = range[0..3]
+
+proc foo(x: var R) =
+  doAssert x in 0..3
+
+var x = 5
+foo(R(x))