commit 084911d9b376fa9bea2567f53854511adc6d07ec (tree) parent 942b250895581f01adf52b3d5addd99b7a4bc0d3 Author: Andrew Kelley <superjoe30@gmail.com> Date: Mon, 4 Dec 2017 02:04:08 -0500 add test for @sizeOf on extern and packed unions Diffstat:
| M | test/cases/union.zig | | | 16 | ++++++++++++++++ |
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/test/cases/union.zig b/test/cases/union.zig @@ -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); +}