summary refs log tree commit diff stats
path: root/tests/arc
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-10-09 16:18:36 +0200
committerGitHub <noreply@github.com>2020-10-09 16:18:36 +0200
commitd4302162885919d4b10a6d846a6f9d53ec9873eb (patch)
treeea721e4d05a2f09d9b964b74bb26e722ca66dd35 /tests/arc
parent16e8005031cdc017405ea0c85ddd03c7adf0cef0 (diff)
downloadNim-d4302162885919d4b10a6d846a6f9d53ec9873eb.tar.gz
fixes #15532 (#15534)
Diffstat (limited to 'tests/arc')
-rw-r--r--tests/arc/tcaseobj.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/arc/tcaseobj.nim b/tests/arc/tcaseobj.nim
index 107cf9fc1..a967a509b 100644
--- a/tests/arc/tcaseobj.nim
+++ b/tests/arc/tcaseobj.nim
@@ -223,3 +223,24 @@ type MyObj = object
 var a = MyObj(kind: false, x0: 1234)
 a.kind = true
 doAssert(a.x1 == "")
+
+block:
+  # bug #15532
+  type Kind = enum
+    k0, k1
+
+  type Foo = object
+    y: int
+    case kind: Kind
+    of k0: x0: int
+    of k1: x1: int
+
+  const j0 = Foo(y: 1, kind: k0, x0: 2)
+  const j1 = Foo(y: 1, kind: k1, x1: 2)
+
+  doAssert j0.y == 1
+  doAssert j0.kind == k0
+  doAssert j1.kind == k1
+
+  doAssert j1.x1 == 2
+  doAssert j0.x0 == 2