fix #12726 Cannot take the compile-time sizeof Atomic types (#15928)

* fix #12726 Cannot take the compile-time sizeof Atomic types

* fix for arch 32
This commit is contained in:
Bung 2020-11-12 16:16:40 +08:00 • committed by GitHub
commit 826e62953f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 7 deletions

View file

@ -0,0 +1,18 @@
discard """
targets: "c cpp"
"""
import std/atomics
block testSize: # issue 12726
type
Node = ptr object
# works
next: Atomic[pointer]
f:AtomicFlag
MyChannel = object
# type not defined completely
back: Atomic[ptr int]
f: AtomicFlag
static:
doAssert sizeof(Node) == sizeof(pointer)
doAssert sizeof(MyChannel) == sizeof(pointer) * 2