add test for union with 1 void field being 0 bits

This commit is contained in:
Andrew Kelley 2017-12-04 02:05:33 -05:00
parent 084911d9b3
commit 54138d9e82

View File

@ -166,3 +166,10 @@ const PackedPtrOrInt = packed union {
test "extern union size" {
comptime assert(@sizeOf(PackedPtrOrInt) == 8);
}
const ZeroBits = union {
OnlyField: void,
};
test "union with only 1 field which is void should be zero bits" {
comptime assert(@sizeOf(ZeroBits) == 0);
}