| ... | ... | @@ -20,6 +20,18 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 20 | 20 | "tmp.zig:2:20: error: use of undefined value here causes undefined behavior", |
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | cases.add("extern struct with non-extern-compatible integer tag type", |
| 24 | \\pub const E = enum(u31) { A, B, C }; |
| 25 | \\pub const S = extern struct { |
| 26 | \\ e: E, |
| 27 | \\}; |
| 28 | \\export fn entry() void { |
| 29 | \\ const s: S = undefined; |
| 30 | \\} |
| 31 | , &[_][]const u8{ |
| 32 | "tmp.zig:3:5: error: extern structs cannot contain fields of type 'E'", |
| 33 | }); |
| 34 | |
| 23 | 35 | cases.add("@Type for exhaustive enum with non-integer tag type", |
| 24 | 36 | \\const TypeInfo = @import("builtin").TypeInfo; |
| 25 | 37 | \\const Tag = @Type(.{ |