summary refs log tree commit diff stats
path: root/tests/casestmt
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2018-06-27 21:36:52 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-06-27 21:36:52 +0200
commit722abbe9c9cfbbbf0dde7f8221cd2a563c6c394a (patch)
treea24192d5af71a862673ea72d727b49ceef1a8069 /tests/casestmt
parentbb23d903b6741c1697ac55f8ee54ff30a9b2cc49 (diff)
downloadNim-722abbe9c9cfbbbf0dde7f8221cd2a563c6c394a.tar.gz
Reject enums with holes when computedGoto is used (#8132)
Fixes #7699
Diffstat (limited to 'tests/casestmt')
-rw-r--r--tests/casestmt/t7699.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/casestmt/t7699.nim b/tests/casestmt/t7699.nim
new file mode 100644
index 000000000..ea08388eb
--- /dev/null
+++ b/tests/casestmt/t7699.nim
@@ -0,0 +1,15 @@
+discard """
+  line: 13
+  errormsg: "case statement cannot work on enums with holes for computed goto"
+"""
+
+type
+  X = enum
+    A = 0, B = 100
+
+var z = A
+while true:
+  {.computedGoto.}
+  case z
+  of A: discard
+  of B: discard