| ... | @@ -1565,6 +1565,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) { | ... | @@ -1565,6 +1565,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) { |
| 1565 | \\} | 1565 | \\} |
| 1566 | , ".tmp_source.zig:8:29: error: field 'b' has index 1 but pointer value is index 0 of struct 'Foo'"); | 1566 | , ".tmp_source.zig:8:29: error: field 'b' has index 1 but pointer value is index 0 of struct 'Foo'"); |
| 1567 | | 1567 | |
| | 1568 | cases.add("@offsetOf - non struct", |
| | 1569 | \\const Foo = i32; |
| | 1570 | \\export fn foo() -> usize { |
| | 1571 | \\ return @offsetOf(Foo, "a"); |
| | 1572 | \\} |
| | 1573 | , ".tmp_source.zig:3:22: error: expected struct type, found 'i32'"); |
| | 1574 | |
| | 1575 | cases.add("@offsetOf - bad field name", |
| | 1576 | \\const Foo = struct { |
| | 1577 | \\ derp: i32, |
| | 1578 | \\}; |
| | 1579 | \\export fn foo() -> usize { |
| | 1580 | \\ return @offsetOf(Foo, "a"); |
| | 1581 | \\} |
| | 1582 | , ".tmp_source.zig:5:27: error: struct 'Foo' has no field 'a'"); |
| | 1583 | |
| 1568 | cases.addExe("missing main fn in executable", | 1584 | cases.addExe("missing main fn in executable", |
| 1569 | \\ | 1585 | \\ |
| 1570 | , "error: no member named 'main' in '"); | 1586 | , "error: no member named 'main' in '"); |