summary refs log tree commit diff stats
path: root/tests/reject/tadrdisc.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/reject/tadrdisc.nim')
-rw-r--r--tests/reject/tadrdisc.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/reject/tadrdisc.nim b/tests/reject/tadrdisc.nim
new file mode 100644
index 000000000..a7118455f
--- /dev/null
+++ b/tests/reject/tadrdisc.nim
@@ -0,0 +1,16 @@
+# Test that the address of a dicriminants cannot be taken
+
+type
+  TKind = enum ka, kb, kc
+  TA = object
+    case k: TKind
+    of ka: x, y: int
+    of kb: a, b: string
+    of kc: c, d: float
+    
+proc setKind(k: var TKind) = 
+  k = kc
+  
+var a: TA
+setKind(a.k) #ERROR_MSG for a 'var' type a variable needs to be passed
+