[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>
This commit is contained in:
ringabout 2022-10-03 22:12:23 +08:00 • committed by GitHub
commit 0f5ad49971
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 12 deletions

18
tests/arc/t18645.nim Normal file
View file

@ -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()