diff options
| author | AdamGoertz <36753247+AdamGoertz@users.noreply.github.com> | 2023-07-29 12:45:01 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-29 12:45:01 -0400 |
| commit | 796927b900ad4b774c30d1cb545d606f23040d2f (patch) | |
| tree | 7fd53185ae5dfadce29a8ab95f27d5bade0ae05c /test/cases/compile_errors | |
| parent | 8d1805f81c97a0b773772e86aa39f26c894b7985 (diff) | |
| download | zig-796927b900ad4b774c30d1cb545d606f23040d2f.tar.gz zig-796927b900ad4b774c30d1cb545d606f23040d2f.zip | |
Allow zero-sized fields in extern structs (#16404)
This change allows the following types to appear in extern structs:
* Zero-bit integers
* void
* zero-sized structs and packed structs
* enums with zero-bit backing integers
* arrays of any length with zero-size elements
Diffstat (limited to 'test/cases/compile_errors')
6 files changed, 6 insertions, 6 deletions
diff --git a/test/cases/compile_errors/exported_enum_without_explicit_integer_tag_type.zig b/test/cases/compile_errors/exported_enum_without_explicit_integer_tag_type.zig index 98a98f7e13..534f674fb2 100644 --- a/test/cases/compile_errors/exported_enum_without_explicit_integer_tag_type.zig +++ b/test/cases/compile_errors/exported_enum_without_explicit_integer_tag_type.zig @@ -14,5 +14,5 @@ comptime { // :3:5: error: unable to export type 'type' // :7:5: error: unable to export type 'tmp.E' // :7:5: note: enum tag type 'u1' is not extern compatible -// :7:5: note: only integers with 8, 16, 32, 64 and 128 bits are extern compatible +// :7:5: note: only integers with 0, 8, 16, 32, 64 and 128 bits are extern compatible // :1:11: note: enum declared here diff --git a/test/cases/compile_errors/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig b/test/cases/compile_errors/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig index 2faa7c8713..beee31721c 100644 --- a/test/cases/compile_errors/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig +++ b/test/cases/compile_errors/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig @@ -43,5 +43,5 @@ export fn entry() void { // // :33:8: error: extern structs cannot contain fields of type 'tmp.E' // :33:8: note: enum tag type 'u9' is not extern compatible -// :33:8: note: only integers with power of two bits are extern compatible +// :33:8: note: only integers with 0 or power of two bits are extern compatible // :2:15: note: enum declared here diff --git a/test/cases/compile_errors/extern_struct_with_non-extern-compatible_integer_tag_type.zig b/test/cases/compile_errors/extern_struct_with_non-extern-compatible_integer_tag_type.zig index a83edb6289..fd418566bc 100644 --- a/test/cases/compile_errors/extern_struct_with_non-extern-compatible_integer_tag_type.zig +++ b/test/cases/compile_errors/extern_struct_with_non-extern-compatible_integer_tag_type.zig @@ -13,5 +13,5 @@ export fn entry() void { // // :3:8: error: extern structs cannot contain fields of type 'tmp.E' // :3:8: note: enum tag type 'u31' is not extern compatible -// :3:8: note: only integers with power of two bits are extern compatible +// :3:8: note: only integers with 0 or power of two bits are extern compatible // :1:15: note: enum declared here diff --git a/test/cases/compile_errors/extern_variable_has_non_extern_type.zig b/test/cases/compile_errors/extern_variable_has_non_extern_type.zig index a572e77c28..ab460934e0 100644 --- a/test/cases/compile_errors/extern_variable_has_non_extern_type.zig +++ b/test/cases/compile_errors/extern_variable_has_non_extern_type.zig @@ -8,4 +8,4 @@ pub export fn entry() void { // target=native // // :1:17: error: extern variable cannot have type 'u3' -// :1:17: note: only integers with power of two bits are extern compatible +// :1:17: note: only integers with 0 or power of two bits are extern compatible diff --git a/test/cases/compile_errors/function_with_non-extern_non-packed_enum_parameter.zig b/test/cases/compile_errors/function_with_non-extern_non-packed_enum_parameter.zig index ae347470f2..ab257ead71 100644 --- a/test/cases/compile_errors/function_with_non-extern_non-packed_enum_parameter.zig +++ b/test/cases/compile_errors/function_with_non-extern_non-packed_enum_parameter.zig @@ -9,5 +9,5 @@ export fn entry(foo: Foo) void { // // :2:17: error: parameter of type 'tmp.Foo' not allowed in function with calling convention 'C' // :2:17: note: enum tag type 'u2' is not extern compatible -// :2:17: note: only integers with 8, 16, 32, 64 and 128 bits are extern compatible +// :2:17: note: only integers with 0, 8, 16, 32, 64 and 128 bits are extern compatible // :1:13: note: enum declared here diff --git a/test/cases/compile_errors/variadic_arg_validation.zig b/test/cases/compile_errors/variadic_arg_validation.zig index bddcef92f6..2e47a4fc1e 100644 --- a/test/cases/compile_errors/variadic_arg_validation.zig +++ b/test/cases/compile_errors/variadic_arg_validation.zig @@ -24,6 +24,6 @@ pub export fn entry3() void { // :4:33: error: integer and float literals passed to variadic function must be casted to a fixed-size number type // :9:24: error: arrays must be passed by reference to variadic function // :13:24: error: cannot pass 'u48' to variadic function -// :13:24: note: only integers with power of two bits are extern compatible +// :13:24: note: only integers with 0 or power of two bits are extern compatible // :17:24: error: cannot pass 'void' to variadic function // :17:24: note: 'void' is a zero bit type; for C 'void' use 'anyopaque' |
