Commit 084911d9b3

Andrew Kelley <superjoe30@gmail.com>
2017-12-04 08:04:08
add test for @sizeOf on extern and packed unions
1 parent 942b250
Changed files (1)
test
cases
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);
+}