summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-10-03 22:12:23 +0800
committerGitHub <noreply@github.com>2022-10-03 16:12:23 +0200
commit0f5ad499714f3fc6bc02b54351e59ecf9946dd5a (patch)
tree6eac6f1519fcfaeb578814e39e7c3ddc800d6063 /tests
parent852a7c4919d7801bc73310fecca14faaeb278652 (diff)
downloadNim-0f5ad499714f3fc6bc02b54351e59ecf9946dd5a.tar.gz
[ARC] fixes #18645; C Compiler error when initializing {.global.} with a block (#19953)
* fixes #18645; C Compiler error when initializing {.global.} with a block:

* arguably cleaner solution

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
Co-authored-by: Araq <rumpf_a@web.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/arc/t18645.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/arc/t18645.nim b/tests/arc/t18645.nim
new file mode 100644
index 000000000..c5fddd4bb
--- /dev/null
+++ b/tests/arc/t18645.nim
@@ -0,0 +1,18 @@
+discard """
+  matrix: "--gc:arc; --gc:refc"
+  output: '''
+1
+2
+3
+'''
+"""
+
+proc bitTypeIdUnion() =
+  var bitId {.global.} = block:
+    0
+  inc bitId
+  echo bitId
+
+bitTypeIdUnion()
+bitTypeIdUnion()
+bitTypeIdUnion()