summary refs log tree commit diff stats
path: root/tests/objects/t22301.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/objects/t22301.nim')
-rw-r--r--tests/objects/t22301.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/objects/t22301.nim b/tests/objects/t22301.nim
new file mode 100644
index 000000000..8746bf584
--- /dev/null
+++ b/tests/objects/t22301.nim
@@ -0,0 +1,17 @@
+discard """
+  errormsg: "branch initialization with a runtime discriminator is not supported for a branch whose fields have default values."
+"""
+
+# bug #22301
+type
+  Enum = enum A, B
+  Object = object
+    case a: Enum
+    of A:
+      integer: int = 200
+    of B:
+      time: string
+
+let x = A
+let s = Object(a: x)
+echo s
\ No newline at end of file