diff options
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index bc2d43706f..812b236716 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -3,6 +3,24 @@ const builtin = @import("builtin"); pub fn addCases(cases: *tests.CompileErrorContext) void { cases.add( + "struct depends on itself via optional field", + \\const LhsExpr = struct { + \\ rhsExpr: ?AstObject, + \\}; + \\const AstObject = union { + \\ lhsExpr: LhsExpr, + \\}; + \\export fn entry() void { + \\ const lhsExpr = LhsExpr{ .rhsExpr = null }; + \\ const obj = AstObject{ .lhsExpr = lhsExpr }; + \\} + , + "tmp.zig:1:17: error: struct 'LhsExpr' depends on itself", + "tmp.zig:5:5: note: while checking this field", + "tmp.zig:2:5: note: while checking this field", + ); + + cases.add( "alignment of enum field specified", \\const Number = enum { \\ a, |
