diff options
| author | Krzysztof Wolicki <der.teufel.mail@gmail.com> | 2024-01-26 14:22:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-26 15:22:15 +0200 |
| commit | 61ba225709b88579984a1a679021d121d1aada64 (patch) | |
| tree | 55734f93d5e8009c5beecec938ef0fe634ddd533 /test/cases/compile_errors | |
| parent | bea958df4d0c5fc38633f09b6490c16e24a03155 (diff) | |
| download | zig-61ba225709b88579984a1a679021d121d1aada64.tar.gz zig-61ba225709b88579984a1a679021d121d1aada64.zip | |
Sema: tuples have no names to be used for reporting errors in finishStructInit
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/missing_field_in_struct_value_expression.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/cases/compile_errors/missing_field_in_struct_value_expression.zig b/test/cases/compile_errors/missing_field_in_struct_value_expression.zig index eec50ee1af..d0b09643b8 100644 --- a/test/cases/compile_errors/missing_field_in_struct_value_expression.zig +++ b/test/cases/compile_errors/missing_field_in_struct_value_expression.zig @@ -13,9 +13,23 @@ export fn f() void { _ = a; } +const B = struct { u32, u32 }; +export fn g() void { + const b = B{0}; + _ = b; +} +export fn h() void { + const c = B{}; + _ = c; +} // error // backend=stage2 // target=native // // :9:16: error: missing struct field: x // :1:11: note: struct 'tmp.A' declared here +// :18:16: error: missing tuple field with index 1 +// :16:11: note: struct declared here +// :22:16: error: missing tuple field with index 0 +// :22:16: note: missing tuple field with index 1 +// :16:11: note: struct 'tmp.B' declared here |
