add test for @sizeOf on extern and packed unions

This commit is contained in:
Andrew Kelley 2017-12-04 02:04:08 -05:00
parent 942b250895
commit 084911d9b3

View File

@ -150,3 +150,19 @@ fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: &const MultipleChoice2) {
});
}
const ExternPtrOrInt = extern union {
ptr: &u8,
int: u64
};
test "extern union size" {
comptime assert(@sizeOf(ExternPtrOrInt) == 8);
}
const PackedPtrOrInt = packed union {
ptr: &u8,
int: u64
};
test "extern union size" {
comptime assert(@sizeOf(PackedPtrOrInt) == 8);
}