| ... | @@ -2130,8 +2130,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -2130,8 +2130,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 2130 | \\ _ = x; | 2130 | \\ _ = x; |
| 2131 | \\} | 2131 | \\} |
| 2132 | , &[_][]const u8{ | 2132 | , &[_][]const u8{ |
| 2133 | "tmp.zig:3:13: error: structs and unions, not enums, support field alignment", | 2133 | "tmp.zig:3:7: error: expected ',', found 'align'", |
| 2134 | "tmp.zig:1:16: note: consider 'union(enum)' here", | | |
| 2135 | }); | 2134 | }); |
| 2136 | | 2135 | |
| 2137 | ctx.objErrStage1("bad alignment type", | 2136 | ctx.objErrStage1("bad alignment type", |
| ... | @@ -3765,8 +3764,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -3765,8 +3764,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 3765 | \\ return _; | 3764 | \\ return _; |
| 3766 | \\} | 3765 | \\} |
| 3767 | , &[_][]const u8{ | 3766 | , &[_][]const u8{ |
| 3768 | "tmp.zig:2:5: error: '_' used as an identifier without @\"_\" syntax", | 3767 | "tmp.zig:2:9: error: '_' used as an identifier without @\"_\" syntax", |
| 3769 | "tmp.zig:3:12: error: '_' used as an identifier without @\"_\" syntax", | | |
| 3770 | }); | 3768 | }); |
| 3771 | | 3769 | |
| 3772 | ctx.objErrStage1("`_` should not be usable inside for", | 3770 | ctx.objErrStage1("`_` should not be usable inside for", |
| ... | @@ -4908,7 +4906,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -4908,7 +4906,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 4908 | \\export fn entry() void { a(); } | 4906 | \\export fn entry() void { a(); } |
| 4909 | , &[_][]const u8{ | 4907 | , &[_][]const u8{ |
| 4910 | "tmp.zig:2:1: error: redeclaration of 'a'", | 4908 | "tmp.zig:2:1: error: redeclaration of 'a'", |
| 4911 | "tmp.zig:1:1: error: other declaration here", | 4909 | "tmp.zig:1:1: note: other declaration here", |
| 4912 | }); | 4910 | }); |
| 4913 | | 4911 | |
| 4914 | ctx.objErrStage1("unreachable with return", | 4912 | ctx.objErrStage1("unreachable with return", |
| ... | @@ -5218,6 +5216,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -5218,6 +5216,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 5218 | \\ .z = 4, | 5216 | \\ .z = 4, |
| 5219 | \\ .y = 2, | 5217 | \\ .y = 2, |
| 5220 | \\ }; | 5218 | \\ }; |
| | 5219 | \\ _ = a; |
| 5221 | \\} | 5220 | \\} |
| 5222 | , &[_][]const u8{ | 5221 | , &[_][]const u8{ |
| 5223 | "tmp.zig:9:17: error: missing field: 'x'", | 5222 | "tmp.zig:9:17: error: missing field: 'x'", |
| ... | @@ -7549,13 +7548,15 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -7549,13 +7548,15 @@ pub fn addCases(ctx: *TestContext) !void { |
| 7549 | \\ }; | 7548 | \\ }; |
| 7550 | \\ | 7549 | \\ |
| 7551 | \\ for ([_]Mode { Mode.Debug, Mode.ReleaseSafe, Mode.ReleaseFast }) |mode| { | 7550 | \\ for ([_]Mode { Mode.Debug, Mode.ReleaseSafe, Mode.ReleaseFast }) |mode| { |
| | 7551 | \\ _ = mode; |
| 7552 | \\ inline for (tests) |test_case| { | 7552 | \\ inline for (tests) |test_case| { |
| 7553 | \\ const foo = test_case.filename ++ ".zig"; | 7553 | \\ const foo = test_case.filename ++ ".zig"; |
| | 7554 | \\ _ = foo; |
| 7554 | \\ } | 7555 | \\ } |
| 7555 | \\ } | 7556 | \\ } |
| 7556 | \\} | 7557 | \\} |
| 7557 | , &[_][]const u8{ | 7558 | , &[_][]const u8{ |
| 7558 | "tmp.zig:37:29: error: cannot store runtime value in compile time variable", | 7559 | "tmp.zig:38:29: error: cannot store runtime value in compile time variable", |
| 7559 | }); | 7560 | }); |
| 7560 | | 7561 | |
| 7561 | ctx.objErrStage1("invalid legacy unicode escape", | 7562 | ctx.objErrStage1("invalid legacy unicode escape", |
| ... | @@ -7980,6 +7981,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -7980,6 +7981,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 7980 | \\}; | 7981 | \\}; |
| 7981 | \\export fn foo() void { | 7982 | \\export fn foo() void { |
| 7982 | \\ const fieldOffset = @offsetOf(Empty, "val",); | 7983 | \\ const fieldOffset = @offsetOf(Empty, "val",); |
| | 7984 | \\ _ = fieldOffset; |
| 7983 | \\} | 7985 | \\} |
| 7984 | , &[_][]const u8{ | 7986 | , &[_][]const u8{ |
| 7985 | "tmp.zig:5:42: error: zero-bit field 'val' in struct 'Empty' has no offset", | 7987 | "tmp.zig:5:42: error: zero-bit field 'val' in struct 'Empty' has no offset", |
| ... | @@ -7991,6 +7993,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -7991,6 +7993,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 7991 | \\}; | 7993 | \\}; |
| 7992 | \\export fn foo() void { | 7994 | \\export fn foo() void { |
| 7993 | \\ const fieldOffset = @bitOffsetOf(Empty, "val",); | 7995 | \\ const fieldOffset = @bitOffsetOf(Empty, "val",); |
| | 7996 | \\ _ = fieldOffset; |
| 7994 | \\} | 7997 | \\} |
| 7995 | , &[_][]const u8{ | 7998 | , &[_][]const u8{ |
| 7996 | "tmp.zig:5:45: error: zero-bit field 'val' in struct 'Empty' has no offset", | 7999 | "tmp.zig:5:45: error: zero-bit field 'val' in struct 'Empty' has no offset", |
| ... | @@ -8004,6 +8007,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -8004,6 +8007,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 8004 | \\comptime { | 8007 | \\comptime { |
| 8005 | \\ var foo = Foo {.Baz = {}}; | 8008 | \\ var foo = Foo {.Baz = {}}; |
| 8006 | \\ const bar_val = foo.Bar; | 8009 | \\ const bar_val = foo.Bar; |
| | 8010 | \\ _ = bar_val; |
| 8007 | \\} | 8011 | \\} |
| 8008 | , &[_][]const u8{ | 8012 | , &[_][]const u8{ |
| 8009 | "tmp.zig:7:24: error: accessing union field 'Bar' while field 'Baz' is set", | 8013 | "tmp.zig:7:24: error: accessing union field 'Bar' while field 'Baz' is set", |
| ... | @@ -8119,6 +8123,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -8119,6 +8123,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 8119 | \\ var x: *const i32 = &w; | 8123 | \\ var x: *const i32 = &w; |
| 8120 | \\ var y: *[1]i32 = x; | 8124 | \\ var y: *[1]i32 = x; |
| 8121 | \\ y[0] += 1; | 8125 | \\ y[0] += 1; |
| | 8126 | \\ _ = byte; |
| 8122 | \\} | 8127 | \\} |
| 8123 | , &[_][]const u8{ | 8128 | , &[_][]const u8{ |
| 8124 | "tmp.zig:4:22: error: expected type '*[1]i32', found '*const i32'", | 8129 | "tmp.zig:4:22: error: expected type '*[1]i32', found '*const i32'", |
| ... | @@ -8145,6 +8150,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -8145,6 +8150,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 8145 | \\export fn f2() void { | 8150 | \\export fn f2() void { |
| 8146 | \\ var x: anyerror!i32 = error.Bad; | 8151 | \\ var x: anyerror!i32 = error.Bad; |
| 8147 | \\ for ("hello") |_| returns() else unreachable; | 8152 | \\ for ("hello") |_| returns() else unreachable; |
| | 8153 | \\ _ = x; |
| 8148 | \\} | 8154 | \\} |
| 8149 | , &[_][]const u8{ | 8155 | , &[_][]const u8{ |
| 8150 | "tmp.zig:5:30: error: expression value is ignored", | 8156 | "tmp.zig:5:30: error: expression value is ignored", |
| ... | @@ -8154,6 +8160,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -8154,6 +8160,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 8154 | ctx.objErrStage1("aligned variable of zero-bit type", | 8160 | ctx.objErrStage1("aligned variable of zero-bit type", |
| 8155 | \\export fn f() void { | 8161 | \\export fn f() void { |
| 8156 | \\ var s: struct {} align(4) = undefined; | 8162 | \\ var s: struct {} align(4) = undefined; |
| | 8163 | \\ _ = s; |
| 8157 | \\} | 8164 | \\} |
| 8158 | , &[_][]const u8{ | 8165 | , &[_][]const u8{ |
| 8159 | "tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned", | 8166 | "tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned", |
| ... | @@ -8637,7 +8644,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -8637,7 +8644,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 8637 | }); | 8644 | }); |
| 8638 | | 8645 | |
| 8639 | ctx.objErrStage1("issue #5221: invalid struct init type referenced by @typeInfo and passed into function", | 8646 | ctx.objErrStage1("issue #5221: invalid struct init type referenced by @typeInfo and passed into function", |
| 8640 | \\fn ignore(comptime param: anytype) void {} | 8647 | \\fn ignore(comptime param: anytype) void {_ = param;} |
| 8641 | \\ | 8648 | \\ |
| 8642 | \\export fn foo() void { | 8649 | \\export fn foo() void { |
| 8643 | \\ const MyStruct = struct { | 8650 | \\ const MyStruct = struct { |