summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tests/ccgbugs/t13062.nim27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ccgbugs/t13062.nim b/tests/ccgbugs/t13062.nim
new file mode 100644
index 000000000..fed32a1f7
--- /dev/null
+++ b/tests/ccgbugs/t13062.nim
@@ -0,0 +1,27 @@
+discard """
+  output: "[p = nil]"
+  targets: "c cpp"
+"""
+
+import atomics
+
+type
+  Pledge* {.exportc.} = object
+    p: PledgePtr
+
+  PledgeKind {.exportc.} = enum
+    Single
+    Iteration
+
+  PledgePtr {.exportc.} = ptr object
+    case kind: PledgeKind
+    of Single:
+      impl: PledgeImpl
+    of Iteration:
+      discard
+
+  PledgeImpl {.exportc.} = object
+    fulfilled: Atomic[bool]
+
+var x: Pledge
+echo x.repr