aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-04-02 14:44:25 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-04-02 18:31:19 -0400
commit5aee17e888c0db7ed0d220334f3adeff6e323cb2 (patch)
tree27699680c82b9aadbb3b2b0e2b53bf74d5536af3 /test
parentddb8aa73f542d3432538e6de466ac216c89fd12b (diff)
downloadzig-5aee17e888c0db7ed0d220334f3adeff6e323cb2.tar.gz
zig-5aee17e888c0db7ed0d220334f3adeff6e323cb2.zip
regression fixes and fix packed struct abi size
Diffstat (limited to 'test')
-rw-r--r--test/stage1/behavior/struct.zig16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/stage1/behavior/struct.zig b/test/stage1/behavior/struct.zig
index aa77892602..62fb41ca28 100644
--- a/test/stage1/behavior/struct.zig
+++ b/test/stage1/behavior/struct.zig
@@ -256,8 +256,8 @@ const Foo96Bits = packed struct {
test "packed struct 24bits" {
comptime {
- expect(@sizeOf(Foo24Bits) == 3);
- expect(@sizeOf(Foo96Bits) == 12);
+ expect(@sizeOf(Foo24Bits) == 4);
+ expect(@sizeOf(Foo96Bits) == 16);
}
var value = Foo96Bits{
@@ -291,16 +291,22 @@ test "packed struct 24bits" {
expect(value.d == 1);
}
+const Foo32Bits = packed struct {
+ field: u24,
+ pad: u8,
+};
+
const FooArray24Bits = packed struct {
a: u16,
- b: [2]Foo24Bits,
+ b: [2]Foo32Bits,
c: u16,
};
+// TODO revisit this test when doing https://github.com/ziglang/zig/issues/1512
test "packed array 24bits" {
comptime {
- expect(@sizeOf([9]Foo24Bits) == 9 * 3);
- expect(@sizeOf(FooArray24Bits) == 2 + 2 * 3 + 2);
+ expect(@sizeOf([9]Foo32Bits) == 9 * 4);
+ expect(@sizeOf(FooArray24Bits) == 2 + 2 * 4 + 2);
}
var bytes = []u8{0} ** (@sizeOf(FooArray24Bits) + 1);