| ... | @@ -2,6 +2,16 @@ const tests = @import("tests.zig"); | ... | @@ -2,6 +2,16 @@ const tests = @import("tests.zig"); |
| 2 | const std = @import("std"); | 2 | const std = @import("std"); |
| 3 | | 3 | |
| 4 | pub fn addCases(cases: *tests.CompileErrorContext) void { | 4 | pub fn addCases(cases: *tests.CompileErrorContext) void { |
| | 5 | cases.add("pointer arithmetic on pointer-to-array", |
| | 6 | \\export fn foo() void { |
| | 7 | \\ var x: [10]u8 = undefined; |
| | 8 | \\ var y = &x; |
| | 9 | \\ var z = y + 1; |
| | 10 | \\} |
| | 11 | , &[_][]const u8{ |
| | 12 | "tmp.zig:4:17: error: integer value 1 cannot be coerced to type '*[10]u8'", |
| | 13 | }); |
| | 14 | |
| 5 | cases.add("@Type() union payload is undefined", | 15 | cases.add("@Type() union payload is undefined", |
| 6 | \\const Foo = @Type(@import("std").builtin.TypeInfo{ | 16 | \\const Foo = @Type(@import("std").builtin.TypeInfo{ |
| 7 | \\ .Struct = undefined, | 17 | \\ .Struct = undefined, |