diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-12-29 00:39:25 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-12-29 00:39:25 -0700 |
| commit | be5130ec535456559497ac241ac9fa76c4bbb8ca (patch) | |
| tree | 072927858110cb69ccc85c31ed1b2055ee83875e /test/behavior/struct.zig | |
| parent | efb7148a4574c608b21359fcbf2edf06afdb5e0c (diff) | |
| download | zig-be5130ec535456559497ac241ac9fa76c4bbb8ca.tar.gz zig-be5130ec535456559497ac241ac9fa76c4bbb8ca.zip | |
compiler_rt: move more functions to the stage2 section
also move more already-passing behavior tests to the passing section.
Diffstat (limited to 'test/behavior/struct.zig')
| -rw-r--r-- | test/behavior/struct.zig | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig index 1e47877fd6..b5841c58fb 100644 --- a/test/behavior/struct.zig +++ b/test/behavior/struct.zig @@ -199,3 +199,30 @@ test "struct field init with catch" { try S.doTheTest(); comptime try S.doTheTest(); } + +test "packed struct field alignment" { + const Stage1 = struct { + var baz: packed struct { + a: u32, + b: u32, + } = undefined; + }; + const Stage2 = struct { + var baz: packed struct { + a: u32, + b: u32 align(1), + } = undefined; + }; + const S = if (builtin.zig_is_stage2) Stage2 else Stage1; + try expect(@TypeOf(&S.baz.b) == *align(1) u32); +} + +const blah: packed struct { + a: u3, + b: u3, + c: u2, +} = undefined; + +test "bit field alignment" { + try expect(@TypeOf(&blah.b) == *align(1:3:1) const u3); +} |
