| ... | @@ -907,6 +907,21 @@ fn f() { | ... | @@ -907,6 +907,21 @@ fn f() { |
| 907 | }; | 907 | }; |
| 908 | } | 908 | } |
| 909 | )SOURCE", 1, ".tmp_source.zig:8:15: error: missing field: 'x'"); | 909 | )SOURCE", 1, ".tmp_source.zig:8:15: error: missing field: 'x'"); |
| | 910 | |
| | 911 | add_compile_fail_case("invalid field in struct value expression", R"SOURCE( |
| | 912 | struct A { |
| | 913 | x : i32, |
| | 914 | y : i32, |
| | 915 | z : i32, |
| | 916 | } |
| | 917 | fn f() { |
| | 918 | const a = A { |
| | 919 | .z = 4, |
| | 920 | .y = 2, |
| | 921 | .foo = 42, |
| | 922 | }; |
| | 923 | } |
| | 924 | )SOURCE", 1, ".tmp_source.zig:11:9: error: no member named 'foo' in 'A'"); |
| 910 | } | 925 | } |
| 911 | | 926 | |
| 912 | static void print_compiler_invocation(TestCase *test_case) { | 927 | static void print_compiler_invocation(TestCase *test_case) { |