diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-11-04 18:47:52 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-11-05 12:54:38 +0200 |
| commit | f92e7bed7b6b83b2cdfe2bfed047e3a7bcdd2116 (patch) | |
| tree | 1e88680f7a1ff2b488f41a7ce89439183456acb2 /test | |
| parent | 51b1083d66b29d110c8cf60b59052170dd34a95f (diff) | |
| download | zig-f92e7bed7b6b83b2cdfe2bfed047e3a7bcdd2116.tar.gz zig-f92e7bed7b6b83b2cdfe2bfed047e3a7bcdd2116.zip | |
stage2: bitsize of packed struct should trigger backing int ty check
Closes #13398
Diffstat (limited to 'test')
| -rw-r--r-- | test/cases/compile_errors/bitsize_of_packed_struct_checks_backing_int_ty.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/cases/compile_errors/bitsize_of_packed_struct_checks_backing_int_ty.zig b/test/cases/compile_errors/bitsize_of_packed_struct_checks_backing_int_ty.zig new file mode 100644 index 0000000000..774a9c3376 --- /dev/null +++ b/test/cases/compile_errors/bitsize_of_packed_struct_checks_backing_int_ty.zig @@ -0,0 +1,13 @@ +const Foo = packed struct(u32) { + x: u1, +}; +fn bar(_: Foo) callconv(.C) void {} +pub export fn entry() void { + bar(.{ .x = 0 }); +} + +// error +// backend=stage2 +// target=native +// +// :1:27: error: backing integer type 'u32' has bit size 32 but the struct fields have a total bit size of 1 |
