allow packed union (#14868)

Co-authored-by: Arne Döring <arne.doering@gmx.net>
This commit is contained in:
Clyybber 2020-07-01 11:41:03 +02:00 • committed by GitHub
commit 1440e70c62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View file

@ -694,3 +694,13 @@ type
doAssert sizeof(O0) == 1
doAssert sizeof(T0) == 1
type
# this thing may not have padding bytes at the end
PackedUnion* {.union, packed.} = object
a*: array[11, byte]
b*: int64
doAssert sizeof(PackedUnion) == 11
doAssert alignof(PackedUnion) == 1