summary refs log tree commit diff stats
path: root/tests/ccgbugs
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-11-13 19:49:30 +0800
committerGitHub <noreply@github.com>2020-11-13 12:49:30 +0100
commitd802a4a669aa8661b4ba80abbd9310b93b9fe605 (patch)
treec96043a30770c544b1385b2ef13fdd846d18bc25 /tests/ccgbugs
parent7d51ad96e9add19c45b3c679f30fcb70d7fbe138 (diff)
downloadNim-d802a4a669aa8661b4ba80abbd9310b93b9fe605.tar.gz
close #13062(add testcase for #13062) (#15956)
Diffstat (limited to 'tests/ccgbugs')
-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