aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors
diff options
context:
space:
mode:
Diffstat (limited to 'test/cases/compile_errors')
-rw-r--r--test/cases/compile_errors/bitsize_of_packed_struct_checks_backing_int_ty.zig13
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