authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-04-28 14:44:34+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-04-28 18:35:01+02:00
log62625d9d9518644bcf4fa94e1d5c67edde22b91b
treedd80ae6e32eb3a0d6b24e1641ede3c6446fd2b6c
parentc8d0fb0b212f2c618321caeeac315c1792b06035

test: migrate stage1 compile error tests to updated test manifest


678 files changed, 2175 insertions(+), 902 deletions(-)

src/test.zig+5-30
......@@ -34,15 +34,12 @@ test {
3434 var ctx = TestContext.init(std.testing.allocator, arena);
3535 defer ctx.deinit();
3636
37 const compile_errors_dir_path = try std.fs.path.join(arena, &.{
38 std.fs.path.dirname(@src().file).?, "..", "test", "compile_errors",
39 });
40
41 var compile_errors_dir = try std.fs.cwd().openDir(compile_errors_dir_path, .{});
42 defer compile_errors_dir.close();
43
4437 {
45 var dir = try compile_errors_dir.openDir("stage2", .{ .iterate = true });
38 const dir_path = try std.fs.path.join(arena, &.{
39 std.fs.path.dirname(@src().file).?, "..", "test", "compile_errors",
40 });
41
42 var dir = try std.fs.cwd().openDir(dir_path, .{ .iterate = true });
4643 defer dir.close();
4744
4845 // TODO make this incremental once the bug is solved that it triggers
......@@ -50,28 +47,6 @@ test {
5047 ctx.addTestCasesFromDir(dir, .independent);
5148 }
5249
53 if (!skip_stage1) {
54 var stage1_dir = try compile_errors_dir.openDir("stage1", .{});
55 defer stage1_dir.close();
56
57 const Config = struct {
58 name: []const u8,
59 is_test: bool,
60 output_mode: std.builtin.OutputMode,
61 };
62
63 for ([_]Config{
64 .{ .name = "obj", .is_test = false, .output_mode = .Obj },
65 .{ .name = "exe", .is_test = false, .output_mode = .Exe },
66 .{ .name = "test", .is_test = true, .output_mode = .Exe },
67 }) |config| {
68 var dir = try stage1_dir.openDir(config.name, .{ .iterate = true });
69 defer dir.close();
70
71 ctx.addErrorCasesFromDir("stage1", dir, .stage1, config.output_mode, config.is_test, .independent);
72 }
73 }
74
7550 {
7651 const dir_path = try std.fs.path.join(arena, &.{
7752 std.fs.path.dirname(@src().file).?, "..", "test", "incremental",
test/cases.zig-5
......@@ -1,11 +1,6 @@
11const std = @import("std");
22const TestContext = @import("../src/test.zig").TestContext;
33
4// Self-hosted has differing levels of support for various architectures. For now we pass explicit
5// target parameters to each test case. At some point we will take this to the next level and have
6// a set of targets that all test cases run on unless specifically overridden. For now, each test
7// case applies to only the specified target.
8
94pub fn addCases(ctx: *TestContext) !void {
105 try @import("compile_errors.zig").addCases(ctx);
116 try @import("stage2/cbe.zig").addCases(ctx);
test/compile_errors.zig-218
......@@ -3,207 +3,6 @@ const builtin = @import("builtin");
33const TestContext = @import("../src/test.zig").TestContext;
44
55pub fn addCases(ctx: *TestContext) !void {
6 {
7 const case = ctx.obj("callconv(.Interrupt) on unsupported platform", .{
8 .cpu_arch = .aarch64,
9 .os_tag = .linux,
10 .abi = .none,
11 });
12 case.backend = .stage1;
13 case.addError(
14 \\export fn entry() callconv(.Interrupt) void {}
15 , &[_][]const u8{
16 "tmp.zig:1:28: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64",
17 });
18 }
19 {
20 var case = ctx.obj("callconv(.Signal) on unsupported platform", .{
21 .cpu_arch = .x86_64,
22 .os_tag = .linux,
23 .abi = .none,
24 });
25 case.backend = .stage1;
26 case.addError(
27 \\export fn entry() callconv(.Signal) void {}
28 , &[_][]const u8{
29 "tmp.zig:1:28: error: callconv 'Signal' is only available on AVR, not x86_64",
30 });
31 }
32 {
33 const case = ctx.obj("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform", .{
34 .cpu_arch = .x86_64,
35 .os_tag = .linux,
36 .abi = .none,
37 });
38 case.backend = .stage1;
39 case.addError(
40 \\const F1 = fn () callconv(.Stdcall) void;
41 \\const F2 = fn () callconv(.Fastcall) void;
42 \\const F3 = fn () callconv(.Thiscall) void;
43 \\export fn entry1() void { var a: F1 = undefined; _ = a; }
44 \\export fn entry2() void { var a: F2 = undefined; _ = a; }
45 \\export fn entry3() void { var a: F3 = undefined; _ = a; }
46 , &[_][]const u8{
47 "tmp.zig:1:27: error: callconv 'Stdcall' is only available on x86, not x86_64",
48 "tmp.zig:2:27: error: callconv 'Fastcall' is only available on x86, not x86_64",
49 "tmp.zig:3:27: error: callconv 'Thiscall' is only available on x86, not x86_64",
50 });
51 }
52 {
53 const case = ctx.obj("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform", .{
54 .cpu_arch = .x86_64,
55 .os_tag = .linux,
56 .abi = .none,
57 });
58 case.backend = .stage1;
59 case.addError(
60 \\export fn entry1() callconv(.Stdcall) void {}
61 \\export fn entry2() callconv(.Fastcall) void {}
62 \\export fn entry3() callconv(.Thiscall) void {}
63 , &[_][]const u8{
64 "tmp.zig:1:29: error: callconv 'Stdcall' is only available on x86, not x86_64",
65 "tmp.zig:2:29: error: callconv 'Fastcall' is only available on x86, not x86_64",
66 "tmp.zig:3:29: error: callconv 'Thiscall' is only available on x86, not x86_64",
67 });
68 }
69 {
70 const case = ctx.obj("callconv(.Vectorcall) on unsupported platform", .{
71 .cpu_arch = .x86_64,
72 .os_tag = .linux,
73 .abi = .none,
74 });
75 case.backend = .stage1;
76 case.addError(
77 \\export fn entry() callconv(.Vectorcall) void {}
78 , &[_][]const u8{
79 "tmp.zig:1:28: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64",
80 });
81 }
82 {
83 const case = ctx.obj("callconv(.APCS, .AAPCS, .AAPCSVFP) on unsupported platform", .{
84 .cpu_arch = .x86_64,
85 .os_tag = .linux,
86 .abi = .none,
87 });
88 case.backend = .stage1;
89 case.addError(
90 \\export fn entry1() callconv(.APCS) void {}
91 \\export fn entry2() callconv(.AAPCS) void {}
92 \\export fn entry3() callconv(.AAPCSVFP) void {}
93 , &[_][]const u8{
94 "tmp.zig:1:29: error: callconv 'APCS' is only available on ARM, not x86_64",
95 "tmp.zig:2:29: error: callconv 'AAPCS' is only available on ARM, not x86_64",
96 "tmp.zig:3:29: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64",
97 });
98 }
99
100 {
101 const case = ctx.obj("call with new stack on unsupported target", .{
102 .cpu_arch = .wasm32,
103 .os_tag = .wasi,
104 .abi = .none,
105 });
106 case.backend = .stage1;
107 case.addError(
108 \\var buf: [10]u8 align(16) = undefined;
109 \\export fn entry() void {
110 \\ @call(.{.stack = &buf}, foo, .{});
111 \\}
112 \\fn foo() void {}
113 , &[_][]const u8{
114 "tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack",
115 });
116 }
117
118 // Note: One of the error messages here is backwards. It would be nice to fix, but that's not
119 // going to stop me from merging this branch which fixes a bunch of other stuff.
120 ctx.objErrStage1("incompatible sentinels",
121 \\export fn entry1(ptr: [*:255]u8) [*:0]u8 {
122 \\ return ptr;
123 \\}
124 \\export fn entry2(ptr: [*]u8) [*:0]u8 {
125 \\ return ptr;
126 \\}
127 \\export fn entry3() void {
128 \\ var array: [2:0]u8 = [_:255]u8{1, 2};
129 \\ _ = array;
130 \\}
131 \\export fn entry4() void {
132 \\ var array: [2:0]u8 = [_]u8{1, 2};
133 \\ _ = array;
134 \\}
135 , &[_][]const u8{
136 "tmp.zig:2:12: error: expected type '[*:0]u8', found '[*:255]u8'",
137 "tmp.zig:2:12: note: destination pointer requires a terminating '0' sentinel, but source pointer has a terminating '255' sentinel",
138 "tmp.zig:5:12: error: expected type '[*:0]u8', found '[*]u8'",
139 "tmp.zig:5:12: note: destination pointer requires a terminating '0' sentinel",
140
141 "tmp.zig:8:35: error: expected type '[2:255]u8', found '[2:0]u8'",
142 "tmp.zig:8:35: note: destination array requires a terminating '255' sentinel, but source array has a terminating '0' sentinel",
143 "tmp.zig:12:31: error: expected type '[2:0]u8', found '[2]u8'",
144 "tmp.zig:12:31: note: destination array requires a terminating '0' sentinel",
145 });
146
147 {
148 const case = ctx.obj("variable in inline assembly template cannot be found", .{
149 .cpu_arch = .x86_64,
150 .os_tag = .linux,
151 .abi = .gnu,
152 });
153 case.backend = .stage1;
154 case.addError(
155 \\export fn entry() void {
156 \\ var sp = asm volatile (
157 \\ "mov %[foo], sp"
158 \\ : [bar] "=r" (-> usize)
159 \\ );
160 \\ _ = sp;
161 \\}
162 , &[_][]const u8{
163 "tmp.zig:2:14: error: could not find 'foo' in the inputs or outputs",
164 });
165 }
166
167 {
168 const case = ctx.obj("bad alignment in @asyncCall", .{
169 .cpu_arch = .aarch64,
170 .os_tag = .linux,
171 .abi = .none,
172 });
173 case.backend = .stage1;
174 case.addError(
175 \\export fn entry() void {
176 \\ var ptr: fn () callconv(.Async) void = func;
177 \\ var bytes: [64]u8 = undefined;
178 \\ _ = @asyncCall(&bytes, {}, ptr, .{});
179 \\}
180 \\fn func() callconv(.Async) void {}
181 , &[_][]const u8{
182 "tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8'",
183 });
184 }
185
186 if (builtin.os.tag == .linux) {
187 ctx.testErrStage1("implicit dependency on libc",
188 \\extern "c" fn exit(u8) void;
189 \\export fn entry() void {
190 \\ exit(0);
191 \\}
192 , &[_][]const u8{
193 "tmp.zig:3:5: error: dependency on libc must be explicitly specified in the build command",
194 });
195
196 ctx.testErrStage1("libc headers note",
197 \\const c = @cImport(@cInclude("stdio.h"));
198 \\export fn entry() void {
199 \\ _ = c.printf("hello, world!\n");
200 \\}
201 , &[_][]const u8{
202 "tmp.zig:1:11: error: C import failed",
203 "tmp.zig:1:11: note: libc headers not available; compilation does not link against libc",
204 });
205 }
206
2076 {
2087 const case = ctx.obj("wrong same named struct", .{});
2098 case.backend = .stage1;
......@@ -366,21 +165,4 @@ pub fn addCases(ctx: *TestContext) !void {
366165 //, &[_][]const u8{
367166 // "tmp.zig:4:1: error: unable to inline function",
368167 //});
369
370 {
371 const case = ctx.obj("align(N) expr function pointers is a compile error", .{
372 .cpu_arch = .wasm32,
373 .os_tag = .freestanding,
374 .abi = .none,
375 });
376 case.backend = .stage1;
377
378 case.addError(
379 \\export fn foo() align(1) void {
380 \\ return;
381 \\}
382 , &[_][]const u8{
383 "tmp.zig:1:23: error: align(N) expr is not allowed on function prototypes in wasm32/wasm64",
384 });
385 }
386168}
test/compile_errors/stage1/exe/main_missing_name.zig+4-1
......@@ -1,5 +1,8 @@
11pub fn (main) void {}
22
3// main missing name
3// error
4// backend=stage1
5// target=native
6// output_mode=Exe
47//
58// tmp.zig:1:5: error: missing function name
test/compile_errors/stage1/exe/missing_main_fn_in_executable.zig+4-1
......@@ -1,5 +1,8 @@
11
22
3// missing main fn in executable
3// error
4// backend=stage1
5// target=native
6// output_mode=Exe
47//
58// error: root source file has no member called 'main'
test/compile_errors/stage1/exe/private_main_fn.zig+4-1
......@@ -1,6 +1,9 @@
11fn main() void {}
22
3// private main fn
3// error
4// backend=stage1
5// target=native
6// output_mode=Exe
47//
58// error: 'main' is private
69// tmp.zig:1:1: note: declared here
test/compile_errors/stage1/obj/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig+3-1
......@@ -5,6 +5,8 @@ export fn a() void {
55 _ = t;
66}
77
8// C pointer pointing to non C ABI compatible type or has align attr
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:19: error: C pointers cannot point to non-C-ABI-compatible type 'Foo'
test/compile_errors/stage1/obj/C_pointer_to_anyopaque.zig+3-1
......@@ -4,6 +4,8 @@ export fn a() void {
44 _ = y;
55}
66
7// C pointer to anyopaque
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:16: error: C pointers cannot point to opaque types
test/compile_errors/stage1/obj/Frame_of_generic_function.zig+3-1
......@@ -7,6 +7,8 @@ fn func(comptime T: type) void {
77 _ = x;
88}
99
10// @Frame() of generic function
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:2:16: error: @Frame() of generic function
test/compile_errors/stage1/obj/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig+3-1
......@@ -8,7 +8,9 @@ export fn f2(x: V(4, u32)) V(4, u32) {
88 return -y;
99}
1010
11// Issue #5586: Make unary minus for unsigned types a compile error
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:3:12: error: negation of type 'u32'
1416// tmp.zig:8:12: error: negation of type 'u32'
test/compile_errors/stage1/obj/Issue_6823_dont_allow_._to_be_followed_by_.zig+3-1
......@@ -3,6 +3,8 @@ fn foo() void {
33 _ = sequence;
44}
55
6// Issue #6823: don't allow .* to be followed by **
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:28: error: '.*' cannot be followed by '*'. Are you missing a space?
test/compile_errors/stage1/obj/Issue_9165_windows_tcp_server_compilation_error.zig+3-1
......@@ -9,6 +9,8 @@ pub fn main() !void {
99 }
1010}
1111
12// Issue #9165: windows tcp server compilation error
12// error
13// backend=stage1
14// target=native
1315//
1416// error: Unsupported OS
test/compile_errors/stage1/obj/access_non-existent_member_of_error_set.zig+3-1
......@@ -4,6 +4,8 @@ comptime {
44 _ = z;
55}
66
7// access non-existent member of error set
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:18: error: no error named 'Bar' in 'Foo'
test/compile_errors/stage1/obj/accessing_runtime_parameter_from_outer_function.zig+3-1
......@@ -12,7 +12,9 @@ export fn entry() void {
1212 _ = x;
1313}
1414
15// accessing runtime parameter from outer function
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:4:24: error: 'y' not accessible from inner function
1820// tmp.zig:3:28: note: crossed function definition here
test/compile_errors/stage1/obj/add_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a += a;
44}
55
6// add assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/add_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a + a;
44}
55
6// add on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/add_overflow_in_function_evaluation.zig+3-1
......@@ -5,6 +5,8 @@ fn add(a: u16, b: u16) u16 {
55
66export fn entry() usize { return @sizeOf(@TypeOf(y)); }
77
8// add overflow in function evaluation
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:14: error: operation caused overflow
test/compile_errors/stage1/obj/add_wrap_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a +%= a;
44}
55
6// add wrap assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/add_wrap_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a +% a;
44}
55
6// add wrap on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/addition_with_non_numbers.zig+3-1
......@@ -5,6 +5,8 @@ const x = Foo {.field = 1} + Foo {.field = 2};
55
66export fn entry() usize { return @sizeOf(@TypeOf(x)); }
77
8// addition with non numbers
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:28: error: invalid operands to binary expression: 'Foo' and 'Foo'
test/compile_errors/stage1/obj/address_of_number_literal.zig+3-1
......@@ -3,6 +3,8 @@ const y = &x;
33fn foo() *const i32 { return y; }
44export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
55
6// address of number literal
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:30: error: expected type '*const i32', found '*const comptime_int'
test/compile_errors/stage1/obj/alignCast_expects_pointer_or_slice.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 @alignCast(4, @as(u32, 3));
33}
44
5// @alignCast expects pointer or slice
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:19: error: expected pointer or slice, found 'u32'
test/compile_errors/stage1/obj/align_n_expr_function_pointers_is_a_compile_error.zig created+9
......@@ -0,0 +1,9 @@
1export fn foo() align(1) void {
2 return;
3}
4
5// error
6// backend=stage1
7// target=wasm32-freestanding-none
8//
9// tmp.zig:1:23: error: align(N) expr is not allowed on function prototypes in wasm32/wasm64
test/compile_errors/stage1/obj/aligned_variable_of_zero-bit_type.zig+3-1
......@@ -3,6 +3,8 @@ export fn f() void {
33 _ = s;
44}
55
6// aligned variable of zero-bit type
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned
test/compile_errors/stage1/obj/alignment_of_enum_field_specified.zig+3-1
......@@ -7,6 +7,8 @@ export fn entry1() void {
77 _ = x;
88}
99
10// alignment of enum field specified
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:7: error: expected ',' after field
test/compile_errors/stage1/obj/ambiguous_decl_reference.zig+3-1
......@@ -12,7 +12,9 @@ export fn entry() void {
1212 bar();
1313}
1414
15// ambiguous decl reference
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:5:13: error: ambiguous reference
1820// tmp.zig:7:9: note: declared here
test/compile_errors/stage1/obj/and_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a and a;
44}
55
6// and on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/array_access_of_non_array.zig+3-1
......@@ -7,7 +7,9 @@ export fn g() void {
77 _ = bad[0];
88}
99
10// array access of non array
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:8: error: array access of non-array type 'bool'
1315// tmp.zig:7:12: error: array access of non-array type 'bool'
test/compile_errors/stage1/obj/array_access_of_type.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33 _ = b;
44}
55
6// array access of type
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:14: error: array access of non-array type 'type'
test/compile_errors/stage1/obj/array_access_of_undeclared_identifier.zig+3-1
......@@ -2,6 +2,8 @@ export fn f() void {
22 i[i] = i[i];
33}
44
5// array access of undeclared identifier
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: use of undeclared identifier 'i'
test/compile_errors/stage1/obj/array_access_with_non_integer_index.zig+3-1
......@@ -9,7 +9,9 @@ export fn g() void {
99 _ = array[bad];
1010}
1111
12// array access with non integer index
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:4:11: error: expected type 'usize', found 'bool'
1517// tmp.zig:9:15: error: expected type 'usize', found 'bool'
test/compile_errors/stage1/obj/array_concatenation_with_wrong_type.zig+3-1
......@@ -4,6 +4,8 @@ const a = derp ++ "foo";
44
55export fn entry() usize { return @sizeOf(@TypeOf(a)); }
66
7// array concatenation with wrong type
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:11: error: expected array, found 'usize'
test/compile_errors/stage1/obj/array_in_c_exported_function.zig+3-1
......@@ -6,7 +6,9 @@ export fn zig_return_array() [10]u8 {
66 return "1234567890".*;
77}
88
9// array in c exported function
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:1:24: error: parameter of type '[10]u8' not allowed in function with calling convention 'C'
1214// tmp.zig:5:30: error: return type '[10]u8' not allowed in function with calling convention 'C'
test/compile_errors/stage1/obj/asm_at_compile_time.zig+3-1
......@@ -10,6 +10,8 @@ fn doSomeAsm() void {
1010 );
1111}
1212
13// asm at compile time
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:6:5: error: unable to evaluate constant expression
test/compile_errors/stage1/obj/assign_inline_fn_to_non-comptime_var.zig+3-1
......@@ -4,7 +4,9 @@ export fn entry() void {
44}
55fn b() callconv(.Inline) void { }
66
7// assign inline fn to non-comptime var
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var
1012// tmp.zig:5:1: note: declared here
test/compile_errors/stage1/obj/assign_null_to_non-optional_pointer.zig+3-1
......@@ -2,6 +2,8 @@ const a: *u8 = null;
22
33export fn entry() usize { return @sizeOf(@TypeOf(a)); }
44
5// assign null to non-optional pointer
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:1:16: error: expected type '*u8', found '@Type(.Null)'
test/compile_errors/stage1/obj/assign_through_constant_pointer.zig+3-1
......@@ -3,6 +3,8 @@ export fn f() void {
33 cstr[0] = 'W';
44}
55
6// assign through constant pointer
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:13: error: cannot assign to constant
test/compile_errors/stage1/obj/assign_through_constant_slice.zig+3-1
......@@ -3,6 +3,8 @@ export fn f() void {
33 cstr[0] = 'W';
44}
55
6// assign through constant slice
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:13: error: cannot assign to constant
test/compile_errors/stage1/obj/assign_to_constant_field.zig+3-1
......@@ -6,6 +6,8 @@ export fn derp() void {
66 f.field = 0;
77}
88
9// assign to constant field
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:6:15: error: cannot assign to constant
test/compile_errors/stage1/obj/assign_to_constant_variable.zig+3-1
......@@ -3,6 +3,8 @@ export fn f() void {
33 a = 4;
44}
55
6// assign to constant variable
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: cannot assign to constant
test/compile_errors/stage1/obj/assign_to_invalid_dereference.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 'a'.* = 1;
33}
44
5// assign to invalid dereference
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:8: error: attempt to dereference non-pointer type 'comptime_int'
test/compile_errors/stage1/obj/assign_too_big_number_to_u16.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33 _ = vga_mem;
44}
55
6// assign too big number to u16
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:24: error: integer value 753664 cannot be coerced to type 'u16'
test/compile_errors/stage1/obj/assign_unreachable.zig+3-1
......@@ -2,7 +2,9 @@ export fn f() void {
22 const a = return;
33}
44
5// assign unreachable
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: unreachable code
810// tmp.zig:2:15: note: control flow is diverted here
test/compile_errors/stage1/obj/assigning_to_struct_or_union_fields_that_are_not_optionals_with_a_function_that_returns_an_optional.zig+3-1
......@@ -14,6 +14,8 @@ export fn entry() void {
1414 _ = s;
1515}
1616
17// assigning to struct or union fields that are not optionals with a function that returns an optional
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:11:27: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'u8', found '?u8'
test/compile_errors/stage1/obj/async_function_depends_on_its_own_frame.zig+3-1
......@@ -6,6 +6,8 @@ fn amain() callconv(.Async) void {
66 _ = x;
77}
88
9// async function depends on its own frame
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:4:1: error: cannot resolve '@Frame(amain)': function not fully analyzed yet
test/compile_errors/stage1/obj/async_function_indirectly_depends_on_its_own_frame.zig+3-1
......@@ -9,7 +9,9 @@ fn other() void {
99 _ = x;
1010}
1111
12// async function indirectly depends on its own frame
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:4:1: error: unable to determine async function frame of 'amain'
1517// tmp.zig:5:10: note: analysis of function 'other' depends on the frame
test/compile_errors/stage1/obj/atomic_orderings_of_atomicStore_Acquire_or_AcqRel.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 @atomicStore(u32, &x, 1, .Acquire);
44}
55
6// atomic orderings of atomicStore Acquire or AcqRel
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:30: error: @atomicStore atomic ordering must not be Acquire or AcqRel
test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-failure_stricter_than_success.zig+3-1
......@@ -4,6 +4,8 @@ export fn f() void {
44 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {}
55}
66
7// atomic orderings of cmpxchg - failure stricter than success
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:4:81: error: failure atomic ordering must be no stricter than success
test/compile_errors/stage1/obj/atomic_orderings_of_cmpxchg-success_Monotonic_or_stricter.zig+3-1
......@@ -4,6 +4,8 @@ export fn f() void {
44 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {}
55}
66
7// atomic orderings of cmpxchg - success Monotonic or stricter
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:4:58: error: success atomic ordering must be Monotonic or stricter
test/compile_errors/stage1/obj/atomic_orderings_of_fence_Acquire_or_stricter.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 @fence(.Monotonic);
33}
44
5// atomic orderings of fence Acquire or stricter
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:12: error: atomic ordering must be Acquire or stricter
test/compile_errors/stage1/obj/atomicrmw_with_bool_op_not_.Xchg.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = @atomicRmw(bool, &x, .Add, true, .SeqCst);
44}
55
6// atomicrmw with bool op not .Xchg
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:30: error: @atomicRmw with bool only allowed with .Xchg
test/compile_errors/stage1/obj/atomicrmw_with_enum_op_not_.Xchg.zig+3-1
......@@ -9,6 +9,8 @@ export fn entry() void {
99 _ = @atomicRmw(E, &x, .Add, .b, .SeqCst);
1010}
1111
12// atomicrmw with enum op not .Xchg
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:9:27: error: @atomicRmw with enum only allowed with .Xchg
test/compile_errors/stage1/obj/atomicrmw_with_float_op_not_.Xchg_.Add_or_.Sub.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = @atomicRmw(f32, &x, .And, 2, .SeqCst);
44}
55
6// atomicrmw with float op not .Xchg, .Add or .Sub
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:29: error: @atomicRmw with float only allowed with .Xchg, .Add and .Sub
test/compile_errors/stage1/obj/attempt_to_cast_enum_literal_to_error.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 }
55}
66
7// attempt to cast enum literal to error
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:9: error: expected type 'error{Hi}', found '@Type(.EnumLiteral)'
test/compile_errors/stage1/obj/attempt_to_close_over_comptime_variable_from_outer_scope.zig+3-1
......@@ -5,7 +5,9 @@ fn SimpleList(comptime L: usize) type {
55 };
66}
77
8// attempt to close over comptime variable from outer scope
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:19: error: mutable 'T' not accessible from here
1113// tmp.zig:2:9: note: declared mutable here
test/compile_errors/stage1/obj/attempt_to_create_17_bit_float_type.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = @Type(.{ .Float = .{ .bits = 17 } });
44}
55
6// attempt to create 17 bit float type
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:16: error: 17-bit float unsupported
test/compile_errors/stage1/obj/attempt_to_negate_a_non-integer_non-float_or_non-vector_type.zig+3-1
......@@ -7,6 +7,8 @@ export fn entry() void {
77 _ = x;
88}
99
10// attempt to negate a non-integer, non-float or non-vector type
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:6:15: error: negation of type 'anyerror!u32'
test/compile_errors/stage1/obj/attempt_to_use_0_bit_type_in_extern_fn.zig+3-1
......@@ -9,7 +9,9 @@ export fn entry2() void {
99 bar(&{});
1010}
1111
12// attempt to use 0 bit type in extern fn
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'
1517// tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'
test/compile_errors/stage1/obj/attempted_double_ampersand.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry(a: bool, b: bool) i32 {
55 return 5678;
66}
77
8// attempted `&&`
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:2:11: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND
test/compile_errors/stage1/obj/attempted_double_pipe_on_boolean_values.zig+3-1
......@@ -5,7 +5,9 @@ export fn entry(a: bool, b: bool) i32 {
55 return 5678;
66}
77
8// attempted `||` on boolean values
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:2:9: error: expected error set type, found 'bool'
1113// tmp.zig:2:11: note: `||` merges error sets; `or` performs boolean OR
test/compile_errors/stage1/obj/attempted_implicit_cast_from_T_to_slice_const_T.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// attempted implicit cast from T to [*]const T
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:30: error: expected type '[*]const bool', found 'bool'
test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_array_len_1_T.zig+3-1
......@@ -6,7 +6,9 @@ export fn entry(byte: u8) void {
66 _ = byte;
77}
88
9// attempted implicit cast from *const T to *[1]T
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:4:22: error: expected type '*[1]i32', found '*const i32'
1214// tmp.zig:4:22: note: cast discards const qualifier
test/compile_errors/stage1/obj/attempted_implicit_cast_from_const_T_to_sliceT.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 _ = x;
55}
66
7// attempted implicit cast from *const T to []T
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:23: error: expected type '[]u32', found '*const u32'
test/compile_errors/stage1/obj/bad_alignCast_at_comptime.zig+3-1
......@@ -4,6 +4,8 @@ comptime {
44 _ = aligned;
55}
66
7// bad @alignCast at comptime
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:35: error: pointer address 0x1 is not aligned to 4 bytes
test/compile_errors/stage1/obj/bad_alignment_in_asynccall.zig created+12
......@@ -0,0 +1,12 @@
1export fn entry() void {
2 var ptr: fn () callconv(.Async) void = func;
3 var bytes: [64]u8 = undefined;
4 _ = @asyncCall(&bytes, {}, ptr, .{});
5}
6fn func() callconv(.Async) void {}
7
8// error
9// backend=stage1
10// target=aarch64-linux-none
11//
12// tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8'
test/compile_errors/stage1/obj/bad_alignment_in_implicit_cast_from_array_pointer_to_slice.zig+3-1
......@@ -4,6 +4,8 @@ export fn a() void {
44 _ = y;
55}
66
7// bad alignment in implicit cast from array pointer to slice
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:30: error: expected type '[]align(16) u8', found '*[10]u8'
test/compile_errors/stage1/obj/bad_alignment_type.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry2() void {
77 _ = x;
88}
99
10// bad alignment type
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:2:20: error: expected type 'u29', found 'bool'
1315// tmp.zig:6:19: error: fractional component prevents float value 12.340000 from being casted to type 'u29'
test/compile_errors/stage1/obj/bad_identifier_in_function_with_struct_defined_inside_function_which_references_local_const.zig+3-1
......@@ -10,6 +10,8 @@ export fn entry() void {
1010 _ = Block;
1111}
1212
13// bad identifier in function with struct defined inside function which references local const
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:8:5: error: use of undeclared identifier 'bogus'
test/compile_errors/stage1/obj/bad_import.zig+3-1
......@@ -1,5 +1,7 @@
11const bogus = @import("bogus-does-not-exist.zig",);
22
3// bad import
3// error
4// backend=stage1
5// target=native
46//
57// tmp.zig:1:23: error: unable to load '${DIR}bogus-does-not-exist.zig': FileNotFound
test/compile_errors/stage1/obj/bad_usage_of_call.zig+3-1
......@@ -19,7 +19,9 @@ fn bar() callconv(.Inline) void {}
1919fn baz1() void {}
2020fn baz2() void {}
2121
22// bad usage of @call
22// error
23// backend=stage1
24// target=native
2325//
2426// tmp.zig:2:21: error: expected tuple or struct, found 'void'
2527// tmp.zig:5:14: error: unable to perform 'never_inline' call at compile-time
test/compile_errors/stage1/obj/bin_and_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a &= a;
44}
55
6// bin and assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/bin_and_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a & a;
44}
55
6// bin and on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/bin_not_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = ~a;
44}
55
6// bin not on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:10: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/bin_or_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a |= a;
44}
55
6// bin or assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/bin_or_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a | a;
44}
55
6// bin or on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/bin_xor_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a ^= a;
44}
55
6// bin xor assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/bin_xor_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a ^ a;
44}
55
6// bin xor on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/binary_not_on_number_literal.zig+3-1
......@@ -4,6 +4,8 @@ var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE -
44
55export fn entry() usize { return @sizeOf(@TypeOf(block_aligned_stuff)); }
66
7// binary not on number literal
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:60: error: unable to perform binary not operation on type 'comptime_int'
test/compile_errors/stage1/obj/bitCast_same_size_but_bit_count_mismatch.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry(byte: u8) void {
33 _ = oops;
44}
55
6// @bitCast same size but bit count mismatch
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:25: error: destination type 'u7' has 7 bits but source type 'u8' has 8 bits
test/compile_errors/stage1/obj/bitCast_to_enum_type.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = y;
44}
55
6// bitCast to enum type
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:24: error: cannot cast a value of type 'y'
test/compile_errors/stage1/obj/bitCast_with_different_sizes_inside_an_expression.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = foo;
44}
55
6// @bitCast with different sizes inside an expression
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:25: error: destination type 'u8' has size 1 but source type 'f32' has size 4
test/compile_errors/stage1/obj/bit_shifting_only_works_on_integer_types.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// bit shifting only works on integer types
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:16: error: bit shifting operation expected integer type, found '*const u8'
test/compile_errors/stage1/obj/bogus_compile_var.zig+3-1
......@@ -1,6 +1,8 @@
11const x = @import("builtin").bogus;
22export fn entry() usize { return @sizeOf(@TypeOf(x)); }
33
4// bogus compile var
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:29: error: container 'builtin' has no member called 'bogus'
test/compile_errors/stage1/obj/bogus_method_call_on_slice.zig+3-1
......@@ -4,6 +4,8 @@ fn f(m: []const u8) void {
44}
55export fn entry() usize { return @sizeOf(@TypeOf(f)); }
66
7// bogus method call on slice
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:6: error: no member named 'copy' in '[]const u8'
test/compile_errors/stage1/obj/bool_not_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = !a;
44}
55
6// bool not on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:10: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/branch_on_undefined_value.zig+3-1
......@@ -2,6 +2,8 @@ const x = if (undefined) true else false;
22
33export fn entry() usize { return @sizeOf(@TypeOf(x)); }
44
5// branch on undefined value
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:1:15: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/cImport_with_bogus_include.zig+3-1
......@@ -1,7 +1,9 @@
11const c = @cImport(@cInclude("bogus.h"));
22export fn entry() usize { return @sizeOf(@TypeOf(c.bogo)); }
33
4// @cImport with bogus include
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:11: error: C import failed
79// .h:1:10: note: 'bogus.h' file not found
test/compile_errors/stage1/obj/call_assigned_to_constant.zig+3-1
......@@ -16,7 +16,9 @@ export fn entry1() void {
1616 baz = bar(42);
1717}
1818
19// call assigned to constant
19// error
20// backend=stage1
21// target=native
2022//
2123// tmp.zig:12:14: error: cannot assign to constant
2224// tmp.zig:16:14: error: cannot assign to constant
test/compile_errors/stage1/obj/call_with_new_stack_on_unsupported_target.zig created+11
......@@ -0,0 +1,11 @@
1var buf: [10]u8 align(16) = undefined;
2export fn entry() void {
3 @call(.{ .stack = &buf }, foo, .{});
4}
5fn foo() void {}
6
7// error
8// backend=stage1
9// target=wasm32-wasi-none
10//
11// tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack
test/compile_errors/stage1/obj/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig created+11
......@@ -0,0 +1,11 @@
1export fn entry1() callconv(.APCS) void {}
2export fn entry2() callconv(.AAPCS) void {}
3export fn entry3() callconv(.AAPCSVFP) void {}
4
5// error
6// backend=stage1
7// target=x86_64-linux-none
8//
9// tmp.zig:1:29: error: callconv 'APCS' is only available on ARM, not x86_64
10// tmp.zig:2:29: error: callconv 'AAPCS' is only available on ARM, not x86_64
11// tmp.zig:3:29: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64
test/compile_errors/stage1/obj/callconv_interrupt_on_unsupported_platform.zig created+7
......@@ -0,0 +1,7 @@
1export fn entry() callconv(.Interrupt) void {}
2
3// error
4// backend=stage1
5// target=aarch64-linux-none
6//
7// tmp.zig:1:28: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64
test/compile_errors/stage1/obj/callconv_signal_on_unsupported_platform.zig created+7
......@@ -0,0 +1,7 @@
1export fn entry() callconv(.Signal) void {}
2
3// error
4// backend=stage1
5// target=x86_64-linux-none
6//
7// tmp.zig:1:28: error: callconv 'Signal' is only available on AVR, not x86_64
test/compile_errors/stage1/obj/callconv_stdcall_fastcall_thiscall_on_unsupported_platform-0.zig created+23
......@@ -0,0 +1,23 @@
1const F1 = fn () callconv(.Stdcall) void;
2const F2 = fn () callconv(.Fastcall) void;
3const F3 = fn () callconv(.Thiscall) void;
4export fn entry1() void {
5 var a: F1 = undefined;
6 _ = a;
7}
8export fn entry2() void {
9 var a: F2 = undefined;
10 _ = a;
11}
12export fn entry3() void {
13 var a: F3 = undefined;
14 _ = a;
15}
16
17// error
18// backend=stage1
19// target=x86_64-linux-none
20//
21// tmp.zig:1:27: error: callconv 'Stdcall' is only available on x86, not x86_64
22// tmp.zig:2:27: error: callconv 'Fastcall' is only available on x86, not x86_64
23// tmp.zig:3:27: error: callconv 'Thiscall' is only available on x86, not x86_64
test/compile_errors/stage1/obj/callconv_stdcall_fastcall_thiscall_on_unsupported_platform-1.zig created+11
......@@ -0,0 +1,11 @@
1export fn entry1() callconv(.Stdcall) void {}
2export fn entry2() callconv(.Fastcall) void {}
3export fn entry3() callconv(.Thiscall) void {}
4
5// error
6// backend=stage1
7// target=x86_64-linux-none
8//
9// tmp.zig:1:29: error: callconv 'Stdcall' is only available on x86, not x86_64
10// tmp.zig:2:29: error: callconv 'Fastcall' is only available on x86, not x86_64
11// tmp.zig:3:29: error: callconv 'Thiscall' is only available on x86, not x86_64
test/compile_errors/stage1/obj/callconv_vectorcall_on_unsupported_platform.zig created+7
......@@ -0,0 +1,7 @@
1export fn entry() callconv(.Vectorcall) void {}
2
3// error
4// backend=stage1
5// target=x86_64-linux-none
6//
7// tmp.zig:1:28: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64
test/compile_errors/stage1/obj/calling_a_generic_function_only_known_at_runtime.zig+3-1
......@@ -7,6 +7,8 @@ pub fn main() !void {
77 foos[0](true);
88}
99
10// calling a generic function only known at runtime
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:7:9: error: calling a generic function requires compile-time known function value
test/compile_errors/stage1/obj/calling_function_with_naked_calling_convention.zig+3-1
......@@ -3,7 +3,9 @@ export fn entry() void {
33}
44fn foo() callconv(.Naked) void { }
55
6// calling function with naked calling convention
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:5: error: unable to call function with naked calling convention
911// tmp.zig:4:1: note: declared here
test/compile_errors/stage1/obj/calling_var_args_extern_function_passing_array_instead_of_pointer.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33}
44pub extern fn foo(format: *const u8, ...) void;
55
6// calling var args extern function, passing array instead of pointer
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:16: error: expected type '*const u8', found '[5:0]u8'
test/compile_errors/stage1/obj/cannot_break_out_of_defer_expression.zig+3-1
......@@ -6,6 +6,8 @@ export fn foo() void {
66 }
77}
88
9// cannot break out of defer expression
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:4:13: error: cannot break out of defer expression
test/compile_errors/stage1/obj/cannot_continue_out_of_defer_expression.zig+3-1
......@@ -6,6 +6,8 @@ export fn foo() void {
66 }
77}
88
9// cannot continue out of defer expression
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:4:13: error: cannot continue out of defer expression
test/compile_errors/stage1/obj/capture_group_on_switch_prong_with_incompatible_payload_types.zig+3-1
......@@ -12,7 +12,9 @@ comptime {
1212 }
1313}
1414
15// capture group on switch prong with incompatible payload types
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:8:20: error: capture group with incompatible types
1820// tmp.zig:8:9: note: type 'usize' here
test/compile_errors/stage1/obj/cast_enum_literal_to_enum_but_it_doesnt_match.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry() void {
77 _ = x;
88}
99
10// cast enum literal to enum but it doesn't match
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:6:20: error: enum 'Foo' has no field named 'c'
1315// tmp.zig:1:13: note: 'Foo' declared here
test/compile_errors/stage1/obj/cast_error_union_of_global_error_set_to_error_union_of_smaller_error_set.zig+3-1
......@@ -7,7 +7,9 @@ fn foo() anyerror!i32 {
77 return error.B;
88}
99
10// cast error union of global error set to error union of smaller error set
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:35: error: expected type 'SmallErrorSet!i32', found 'anyerror!i32'
1315// tmp.zig:3:35: note: error set 'anyerror' cannot cast into error set 'SmallErrorSet'
test/compile_errors/stage1/obj/cast_global_error_set_to_error_set.zig+3-1
......@@ -7,7 +7,9 @@ fn foo() anyerror {
77 return error.B;
88}
99
10// cast global error set to error set
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:31: error: expected type 'SmallErrorSet', found 'anyerror'
1315// tmp.zig:3:31: note: cannot cast global error set into smaller set
test/compile_errors/stage1/obj/cast_negative_integer_literal_to_usize.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// cast negative integer literal to usize
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:26: error: cannot cast negative value -10 to unsigned integer type 'usize'
test/compile_errors/stage1/obj/cast_negative_value_to_unsigned_integer.zig+3-1
......@@ -9,7 +9,9 @@ export fn entry1() void {
99 _ = unsigned;
1010}
1111
12// cast negative value to unsigned integer
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:3:22: error: attempt to cast negative value to unsigned integer
1517// tmp.zig:8:27: error: cannot cast negative value -1 to unsigned integer type 'u32'
test/compile_errors/stage1/obj/cast_unreachable.zig+3-1
......@@ -3,7 +3,9 @@ fn f() i32 {
33}
44export fn entry() void { _ = f(); }
55
6// cast unreachable
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:12: error: unreachable code
911// tmp.zig:2:21: note: control flow is diverted here
test/compile_errors/stage1/obj/casting_bit_offset_pointer_to_regular_pointer.zig+3-1
......@@ -14,6 +14,8 @@ fn bar(x: *const u3) u3 {
1414
1515export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1616
17// casting bit offset pointer to regular pointer
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:8:26: error: expected type '*const u3', found '*align(:3:1) const u3'
test/compile_errors/stage1/obj/catch_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a catch false;
44}
55
6// catch on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:11: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/chained_comparison_operators.zig+3-1
......@@ -2,6 +2,8 @@ export fn a(value: u32) bool {
22 return 1 < value < 1000;
33}
44
5// chained comparison operators
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:22: error: comparison operators cannot be chained
test/compile_errors/stage1/obj/cmpxchg_with_float.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst);
44}
55
6// cmpxchg with float
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:22: error: expected bool, integer, enum or pointer type, found 'f32'
test/compile_errors/stage1/obj/colliding_invalid_top_level_functions.zig+3-1
......@@ -2,7 +2,9 @@ fn func() bogus {}
22fn func() bogus {}
33export fn entry() usize { return @sizeOf(@TypeOf(func)); }
44
5// colliding invalid top level functions
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:1: error: redeclaration of 'func'
810// tmp.zig:1:1: note: other declaration here
test/compile_errors/stage1/obj/compare_optional_to_non-optional_with_invalid_types.zig+3-1
......@@ -22,7 +22,9 @@ export fn invalidChildType() void {
2222 _ = (x == y);
2323}
2424
25// compare optional to non-optional with invalid types
25// error
26// backend=stage1
27// target=native
2628//
2729// :4:12: error: cannot compare types '?i32' and 'comptime_int'
2830// :4:12: note: optional child type 'i32' must be the same as non-optional type 'comptime_int'
test/compile_errors/stage1/obj/comparing_a_non-optional_pointer_against_null.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = &x == null;
44}
55
6// comparing a non-optional pointer against null
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:12: error: comparison of '*i32' with null
test/compile_errors/stage1/obj/comparing_against_undefined_produces_undefined_value.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 if (2 == undefined) {}
33}
44
5// comparing against undefined produces undefined value
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:11: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/comparison_operators_with_undefined_value.zig+3-1
......@@ -35,7 +35,9 @@ comptime {
3535 if (a <= a) x += 1;
3636}
3737
38// comparison operators with undefined value
38// error
39// backend=stage1
40// target=native
3941//
4042// tmp.zig:5:11: error: use of undefined value here causes undefined behavior
4143// tmp.zig:11:11: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/comparison_with_error_union_and_error_value.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = number_or_error == error.SomethingAwful;
44}
55
6// comparison with error union and error value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:25: error: operator not allowed for type 'anyerror!i32'
test/compile_errors/stage1/obj/compile-time_division_by_zero.zig+3-1
......@@ -5,6 +5,8 @@ comptime {
55 _ = c;
66}
77
8// compile-time division by zero
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:17: error: division by zero
test/compile_errors/stage1/obj/compile-time_remainder_division_by_zero.zig+3-1
......@@ -5,6 +5,8 @@ comptime {
55 _ = c;
66}
77
8// compile-time remainder division by zero
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:17: error: division by zero
test/compile_errors/stage1/obj/compileError_shows_traceback_of_references_that_caused_it.zig+3-1
......@@ -7,6 +7,8 @@ export fn entry() i32 {
77 return bar;
88}
99
10// @compileError shows traceback of references that caused it
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:1:13: error: aoeu
test/compile_errors/stage1/obj/compileLog_of_tagged_enum_doesnt_crash_the_compiler.zig+3-1
......@@ -10,6 +10,8 @@ pub fn main () void {
1010 comptime testCompileLog(Bar{.X = 123});
1111}
1212
13// compileLog of tagged enum doesn't crash the compiler
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:6:5: error: found compile log statement
test/compile_errors/stage1/obj/compile_error_in_struct_init_expression.zig+3-1
......@@ -9,6 +9,8 @@ export fn entry() void {
99 _ = x;
1010}
1111
12// compile error in struct init expression
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:2:14: error: use of undeclared identifier 'crap'
test/compile_errors/stage1/obj/compile_error_when_evaluating_return_type_of_inferred_error_set.zig+3-1
......@@ -7,6 +7,8 @@ export fn entry() void {
77 _ = car;
88}
99
10// compile error when evaluating return type of inferred error set
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:2:11: error: use of undeclared identifier 'SymbolThatDoesNotExist'
test/compile_errors/stage1/obj/compile_log.zig+3-1
......@@ -7,7 +7,9 @@ fn bar(a: i32, b: []const u8) void {
77 @compileLog("end",);
88}
99
10// compile log
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:5:5: error: found compile log statement
1315// tmp.zig:6:5: error: found compile log statement
test/compile_errors/stage1/obj/compile_log_a_pointer_to_an_opaque_value.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 @compileLog(@ptrCast(*const anyopaque, &entry));
33}
44
5// compile log a pointer to an opaque value
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: found compile log statement
test/compile_errors/stage1/obj/compile_log_statement_inside_function_which_must_be_comptime_evaluated.zig+3-1
......@@ -7,6 +7,8 @@ export fn entry() void {
77 _ = @typeName(Foo(i32));
88}
99
10// compile log statement inside function which must be comptime evaluated
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:2:5: error: found compile log statement
test/compile_errors/stage1/obj/compile_log_statement_warning_deduplication_in_generic_fn.zig+3-1
......@@ -7,6 +7,8 @@ fn inner(comptime n: usize) void {
77 inline while (i < n) : (i += 1) { @compileLog("!@#$"); }
88}
99
10// compile log statement warning deduplication in generic fn
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:7:39: error: found compile log statement
test/compile_errors/stage1/obj/compile_time_division_by_zero.zig+3-1
......@@ -5,6 +5,8 @@ fn foo(x: u32) u32 {
55
66export fn entry() usize { return @sizeOf(@TypeOf(y)); }
77
8// compile time division by zero
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:14: error: division by zero
test/compile_errors/stage1/obj/comptime_cast_enum_to_union_but_field_has_payload.zig+3-1
......@@ -9,7 +9,9 @@ export fn entry() void {
99 _ = x;
1010}
1111
12// comptime cast enum to union but field has payload
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:8:26: error: cast to union 'Value' must initialize 'i32' field 'A'
1517// tmp.zig:3:5: note: field 'A' declared here
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_catch.zig+3-1
......@@ -8,7 +8,9 @@ fn bad() !void {
88 return error.Bad;
99}
1010
11// comptime continue inside runtime catch
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:4:21: error: comptime control flow inside runtime block
1416// tmp.zig:4:15: note: runtime block created here
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_bool.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry() void {
77 }
88}
99
10// comptime continue inside runtime if bool
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:5:22: error: comptime control flow inside runtime block
1315// tmp.zig:5:9: note: runtime block created here
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_error.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry() void {
77 }
88}
99
10// comptime continue inside runtime if error
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:5:20: error: comptime control flow inside runtime block
1315// tmp.zig:5:9: note: runtime block created here
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_if_optional.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry() void {
77 }
88}
99
10// comptime continue inside runtime if optional
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:5:20: error: comptime control flow inside runtime block
1315// tmp.zig:5:9: note: runtime block created here
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_switch.zig+3-1
......@@ -10,7 +10,9 @@ export fn entry() void {
1010 }
1111}
1212
13// comptime continue inside runtime switch
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:6:19: error: comptime control flow inside runtime block
1618// tmp.zig:5:9: note: runtime block created here
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_bool.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry() void {
77 }
88}
99
10// comptime continue inside runtime while bool
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:5:25: error: comptime control flow inside runtime block
1315// tmp.zig:5:9: note: runtime block created here
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_error.zig+3-1
......@@ -9,7 +9,9 @@ export fn entry() void {
99 }
1010}
1111
12// comptime continue inside runtime while error
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:6:13: error: comptime control flow inside runtime block
1517// tmp.zig:5:9: note: runtime block created here
test/compile_errors/stage1/obj/comptime_continue_inside_runtime_while_optional.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry() void {
77 }
88}
99
10// comptime continue inside runtime while optional
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:5:23: error: comptime control flow inside runtime block
1315// tmp.zig:5:9: note: runtime block created here
test/compile_errors/stage1/obj/comptime_float_in_asm_input.zig+3-1
......@@ -2,6 +2,8 @@ export fn foo() void {
22 asm volatile ("" : : [bar]"r"(3.17) : "");
33}
44
5// comptime_float in asm input
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:35: error: expected sized integer or sized float, found comptime_float
test/compile_errors/stage1/obj/comptime_implicit_cast_f64_to_f32.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 _ = y;
55}
66
7// comptime implicit cast f64 to f32
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:20: error: cast of value 16777217.000000 to type 'f32' loses information
test/compile_errors/stage1/obj/comptime_int_in_asm_input.zig+3-1
......@@ -2,6 +2,8 @@ export fn foo() void {
22 asm volatile ("" : : [bar]"r"(3) : "");
33}
44
5// comptime_int in asm input
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:35: error: expected sized integer or sized float, found comptime_int
test/compile_errors/stage1/obj/comptime_ptrcast_of_zero-sized_type.zig+3-1
......@@ -5,6 +5,8 @@ fn foo() void {
55}
66comptime { foo(); }
77
8// comptime ptrcast of zero-sized type
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:21: error: '*const struct:2:17' and '[*]const u8' do not have the same in-memory representation
test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig+3-1
......@@ -54,7 +54,9 @@ export fn foo_slice() void {
5454 }
5555}
5656
57// comptime slice-sentinel does not match memory at target index (terminated)
57// error
58// backend=stage1
59// target=native
5860//
5961// :4:29: error: slice-sentinel does not match memory at target index
6062// :12:29: error: slice-sentinel does not match memory at target index
test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig+3-1
......@@ -54,7 +54,9 @@ export fn foo_slice() void {
5454 }
5555}
5656
57// comptime slice-sentinel does not match memory at target index (unterminated)
57// error
58// backend=stage1
59// target=native
5860//
5961// :4:29: error: slice-sentinel does not match memory at target index
6062// :12:29: error: slice-sentinel does not match memory at target index
test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_target-sentinel.zig+3-1
......@@ -54,7 +54,9 @@ export fn foo_slice() void {
5454 }
5555}
5656
57// comptime slice-sentinel does not match target-sentinel
57// error
58// backend=stage1
59// target=native
5860//
5961// :4:29: error: slice-sentinel does not match target-sentinel
6062// :12:29: error: slice-sentinel does not match target-sentinel
test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_terminated.zig+3-1
......@@ -54,7 +54,9 @@ export fn foo_slice() void {
5454 }
5555}
5656
57// comptime slice-sentinel is out of bounds (terminated)
57// error
58// backend=stage1
59// target=native
5860//
5961// :4:29: error: out of bounds slice
6062// :12:29: error: out of bounds slice
test/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig+3-1
......@@ -54,7 +54,9 @@ export fn foo_slice() void {
5454 }
5555}
5656
57// comptime slice-sentinel is out of bounds (unterminated)
57// error
58// backend=stage1
59// target=native
5860//
5961// :4:29: error: slice-sentinel is out of bounds
6062// :12:29: error: slice-sentinel is out of bounds
test/compile_errors/stage1/obj/comptime_slice_of_an_undefined_slice.zig+3-1
......@@ -4,6 +4,8 @@ comptime {
44 _ = b;
55}
66
7// comptime slice of an undefined slice
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:14: error: slice of undefined
test/compile_errors/stage1/obj/comptime_slice_of_undefined_pointer_non-zero_len.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = slice;
44}
55
6// comptime slice of undefined pointer non-zero len
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:41: error: non-zero length slice of undefined pointer
test/compile_errors/stage1/obj/comptime_struct_field_no_init_value.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 _ = f;
77}
88
9// comptime struct field, no init value
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:2:5: error: comptime field without default initialization value
test/compile_errors/stage1/obj/const_frame_cast_to_anyframe.zig+3-1
......@@ -11,7 +11,9 @@ fn func() void {
1111 suspend {}
1212}
1313
14// const frame cast to anyframe
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:3:12: error: expected type 'anyframe', found '*const @Frame(func)'
1719// tmp.zig:7:24: error: expected type 'anyframe', found '*const @Frame(func)'
test/compile_errors/stage1/obj/const_is_a_statement_not_an_expression.zig+3-1
......@@ -2,6 +2,8 @@ export fn f() void {
22 (const a = 0);
33}
44
5// const is a statement, not an expression
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:6: error: expected expression, found 'const'
test/compile_errors/stage1/obj/container_init_with_non-type.zig+3-1
......@@ -3,6 +3,8 @@ const a = zero{1};
33
44export fn entry() usize { return @sizeOf(@TypeOf(a)); }
55
6// container init with non-type
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:11: error: expected type 'type', found 'i32'
test/compile_errors/stage1/obj/control_flow_uses_comptime_var_at_runtime.zig+3-1
......@@ -7,7 +7,9 @@ export fn foo() void {
77
88fn bar() void { }
99
10// control flow uses comptime var at runtime
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:5: error: control flow attempts to use compile-time variable at runtime
1315// tmp.zig:3:24: note: compile-time variable assigned here
test/compile_errors/stage1/obj/control_reaches_end_of_non-void_function.zig+3-1
......@@ -1,6 +1,8 @@
11fn a() i32 {}
22export fn entry() void { _ = a(); }
33
4// control reaches end of non-void function
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:12: error: expected type 'i32', found 'void'
test/compile_errors/stage1/obj/declaration_between_fields.zig+3-1
......@@ -15,7 +15,9 @@ comptime {
1515 _ = S;
1616}
1717
18// declaration between fields
18// error
19// backend=stage1
20// target=native
1921//
2022// tmp.zig:9:5: error: declarations are not allowed between container fields
2123// tmp.zig:5:5: note: field before declarations here
test/compile_errors/stage1/obj/declaration_with_same_name_as_primitive_must_use_special_syntax.zig+3-1
......@@ -4,7 +4,9 @@ export fn entry() void {
44 _ = a;
55}
66
7// declaration with same name as primitive must use special syntax
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:1:7: error: name shadows primitive 'u8'
1012// tmp.zig:1:7: note: consider using @"u8" to disambiguate
test/compile_errors/stage1/obj/deduplicate_undeclared_identifier.zig+3-1
......@@ -5,6 +5,8 @@ export fn b() void {
55 x += 1;
66}
77
8// deduplicate undeclared identifier
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:2:5: error: use of undeclared identifier 'x'
test/compile_errors/stage1/obj/deref_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a.*;
44}
55
6// deref on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: attempt to dereference undefined value
test/compile_errors/stage1/obj/deref_slice_and_get_len_field.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = a.*.len;
44}
55
6// deref slice and get len field
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:10: error: attempt to dereference non-pointer type '[]u8'
test/compile_errors/stage1/obj/dereference_an_array.zig+3-1
......@@ -7,6 +7,8 @@ pub fn pass(in: []u8) []u8 {
77
88export fn entry() usize { return @sizeOf(@TypeOf(pass)); }
99
10// dereference an array
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:4:10: error: attempt to dereference non-pointer type '[10]u8'
test/compile_errors/stage1/obj/dereference_unknown_length_pointer.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry(x: [*]i32) i32 {
22 return x.*;
33}
44
5// dereference unknown length pointer
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:13: error: index syntax required for unknown-length pointer type '[*]i32'
test/compile_errors/stage1/obj/direct_struct_loop.zig+3-1
......@@ -1,6 +1,8 @@
11const A = struct { a : A, };
22export fn entry() usize { return @sizeOf(A); }
33
4// direct struct loop
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:11: error: struct 'A' depends on itself
test/compile_errors/stage1/obj/directly_embedding_opaque_type_in_struct_and_union.zig+3-1
......@@ -20,7 +20,9 @@ export fn c() void {
2020 _ = qux;
2121}
2222
23// directly embedding opaque type in struct and union
23// error
24// backend=stage1
25// target=native
2426//
2527// tmp.zig:3:5: error: opaque types have unknown size and therefore cannot be directly embedded in structs
2628// tmp.zig:7:5: error: opaque types have unknown size and therefore cannot be directly embedded in unions
test/compile_errors/stage1/obj/disallow_coercion_from_non-null-terminated_pointer_to_null-terminated_pointer.zig+3-1
......@@ -5,6 +5,8 @@ pub fn main() void {
55 _ = puts(no_zero_ptr);
66}
77
8// disallow coercion from non-null-terminated pointer to null-terminated pointer
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:14: error: expected type '[*:0]const u8', found '[*]const u8'
test/compile_errors/stage1/obj/discarding_error_value.zig+3-1
......@@ -5,6 +5,8 @@ fn foo() !void {
55 return error.OutOfMemory;
66}
77
8// discarding error value
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:2:12: error: error is discarded. consider using `try`, `catch`, or `if`
test/compile_errors/stage1/obj/div_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a /= a;
44}
55
6// div assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/div_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a / a;
44}
55
6// div on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/division_by_zero.zig+3-1
......@@ -8,7 +8,9 @@ export fn entry2() usize { return @sizeOf(@TypeOf(lit_float_x)); }
88export fn entry3() usize { return @sizeOf(@TypeOf(int_x)); }
99export fn entry4() usize { return @sizeOf(@TypeOf(float_x)); }
1010
11// division by zero
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:1:21: error: division by zero
1416// tmp.zig:2:25: error: division by zero
test/compile_errors/stage1/obj/dont_implicit_cast_double_pointer_to_anyopaque.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 _ = ptr2;
77}
88
9// don't implicit cast double pointer to *anyopaque
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:29: error: expected type '*anyopaque', found '**u32'
test/compile_errors/stage1/obj/double_optional_on_main_return_value.zig+3-1
......@@ -1,6 +1,8 @@
11pub fn main() ??void {
22}
33
4// double ?? on main return value
4// error
5// backend=stage1
6// target=native
57//
68// error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'
test/compile_errors/stage1/obj/duplicate_boolean_switch_value.zig+3-1
......@@ -15,7 +15,9 @@ comptime {
1515 _ = x;
1616}
1717
18// duplicate boolean switch value
18// error
19// backend=stage1
20// target=native
1921//
2022// tmp.zig:5:9: error: duplicate switch value
2123// tmp.zig:13:9: error: duplicate switch value
test/compile_errors/stage1/obj/duplicate_enum_field.zig+3-1
......@@ -8,7 +8,9 @@ export fn entry() void {
88 _ = a;
99}
1010
11// duplicate enum field
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:3:5: error: duplicate enum field: 'Bar'
1416// tmp.zig:2:5: note: other field here
test/compile_errors/stage1/obj/duplicate_error_in_switch.zig+3-1
......@@ -14,7 +14,9 @@ fn foo(x: i32) !void {
1414 }
1515}
1616
17// duplicate error in switch
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:5:14: error: duplicate switch value: '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set.Foo'
2022// tmp.zig:3:14: note: other value here
test/compile_errors/stage1/obj/duplicate_error_value_in_error_set.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry() void {
77 _ = a;
88}
99
10// duplicate error value in error set
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:5: error: duplicate error set field 'Bar'
1315// tmp.zig:2:5: note: previous declaration here
test/compile_errors/stage1/obj/duplicate_field_in_struct_value_expression.zig+3-1
......@@ -13,6 +13,8 @@ export fn f() void {
1313 _ = a;
1414}
1515
16// duplicate field in struct value expression
16// error
17// backend=stage1
18// target=native
1719//
1820// tmp.zig:11:9: error: duplicate field
test/compile_errors/stage1/obj/duplicate_struct_field.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry() void {
77 _ = a;
88}
99
10// duplicate struct field
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:5: error: duplicate struct field: 'Bar'
1315// tmp.zig:2:5: note: other field here
test/compile_errors/stage1/obj/duplicate_union_field.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry() void {
77 _ = a;
88}
99
10// duplicate union field
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:5: error: duplicate union field: 'Bar'
1315// tmp.zig:2:5: note: other field here
test/compile_errors/stage1/obj/embedFile_with_bogus_file.zig+3-1
......@@ -2,6 +2,8 @@ const resource = @embedFile("bogus.txt",);
22
33export fn entry() usize { return @sizeOf(@TypeOf(resource)); }
44
5// @embedFile with bogus file
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:1:29: error: unable to find '
test/compile_errors/stage1/obj/empty_for_loop_body.zig+3-1
......@@ -2,6 +2,8 @@ export fn a() void {
22 for(undefined) |x|;
33}
44
5// empty for loop body
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:23: error: expected block or assignment, found ';'
test/compile_errors/stage1/obj/empty_if_body.zig+3-1
......@@ -2,6 +2,8 @@ export fn a() void {
22 if(true);
33}
44
5// empty if body
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:13: error: expected block or assignment, found ';'
test/compile_errors/stage1/obj/empty_switch_on_an_integer.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 switch(x) {}
44}
55
6// empty switch on an integer
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: switch must handle all possibilities
test/compile_errors/stage1/obj/empty_while_loop_body.zig+3-1
......@@ -2,6 +2,8 @@ export fn a() void {
22 while(true);
33}
44
5// empty while loop body
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:16: error: expected block or assignment, found ';'
test/compile_errors/stage1/obj/endless_loop_in_function_evaluation.zig+3-1
......@@ -5,6 +5,8 @@ fn fibonacci(x: i32) i32 {
55
66export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); }
77
8// endless loop in function evaluation
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:21: error: evaluation exceeded 1000 backwards branches
test/compile_errors/stage1/obj/enum_field_value_references_enum.zig+3-1
......@@ -8,6 +8,8 @@ export fn entry() void {
88}
99const D = 1;
1010
11// enum field value references enum
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:1:17: error: enum 'Foo' depends on itself
test/compile_errors/stage1/obj/enum_in_field_count_range_but_not_matching_tag.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry() void {
77 _ = x;
88}
99
10// enum in field count range but not matching tag
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:6:13: error: enum 'Foo' has no tag matching integer value 0
1315// tmp.zig:1:13: note: 'Foo' declared here
test/compile_errors/stage1/obj/enum_value_already_taken.zig+3-1
......@@ -10,7 +10,9 @@ export fn entry() void {
1010 _ = x;
1111}
1212
13// enum value already taken
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:6:5: error: enum tag value 60 already taken
1618// tmp.zig:4:5: note: other occurrence here
test/compile_errors/stage1/obj/enum_with_0_fields.zig+3-1
......@@ -1,5 +1,7 @@
11const Foo = enum {};
22
3// enum with 0 fields
3// error
4// backend=stage1
5// target=native
46//
57// tmp.zig:1:13: error: enum declarations must have at least one tag
test/compile_errors/stage1/obj/enum_with_declarations_unavailable_for_reify_type.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 _ = @Type(@typeInfo(enum { foo, const bar = 1; }));
33}
44
5// enum with declarations unavailable for @Type
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:15: error: Type.Enum.decls must be empty for @Type
test/compile_errors/stage1/obj/error_equality_but_sets_have_no_common_members.zig+3-1
......@@ -9,6 +9,8 @@ fn foo(x: Set1) void {
99 }
1010}
1111
12// error equality but sets have no common members
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:7:11: error: error sets 'Set1' and 'Set2' have no common errors
test/compile_errors/stage1/obj/error_not_handled_in_switch.zig+3-1
......@@ -12,7 +12,9 @@ fn foo(x: i32) !void {
1212 }
1313}
1414
15// error not handled in switch
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:2:26: error: error.Baz not handled in switch
1820// tmp.zig:2:26: error: error.Bar not handled in switch
test/compile_errors/stage1/obj/error_note_for_function_parameter_incompatibility.zig+3-1
......@@ -4,7 +4,9 @@ export fn entry() void {
44 do_the_thing(bar);
55}
66
7// error note for function parameter incompatibility
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:4:18: error: expected type 'fn(i32) void', found 'fn(bool) void
1012// tmp.zig:4:18: note: parameter 0: 'bool' cannot cast into 'i32'
test/compile_errors/stage1/obj/error_union_operator_with_non_error_set_LHS.zig+3-1
......@@ -4,6 +4,8 @@ comptime {
44 _ = x;
55}
66
7// error union operator with non error set LHS
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:2:15: error: expected error set type, found type 'i32'
test/compile_errors/stage1/obj/error_when_evaluating_return_type.zig+3-1
......@@ -10,6 +10,8 @@ export fn entry() void {
1010 _ = rule_set;
1111}
1212
13// error when evaluating return type
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:2:19: error: expected type 'i32', found 'type'
test/compile_errors/stage1/obj/exceeded_maximum_bit_width_of_integer.zig+3-1
......@@ -7,7 +7,9 @@ export fn entry2() void {
77 _ = x;
88}
99
10// exceeded maximum bit width of integer
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:2:15: error: primitive integer type 'u65536' exceeds maximum bit width of 65535
1315// tmp.zig:6:12: error: primitive integer type 'i65536' exceeds maximum bit width of 65535
test/compile_errors/stage1/obj/explicit_cast_float_literal_to_integer_when_there_is_a_fraction_component.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() i32 {
22 return @as(i32, 12.34);
33}
44
5// explicit cast float literal to integer when there is a fraction component
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:21: error: fractional component prevents float value 12.340000 from being casted to type 'i32'
test/compile_errors/stage1/obj/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig+3-1
......@@ -6,6 +6,8 @@ comptime {
66 _ = y;
77}
88
9// explicit error set cast known at comptime violates error sets
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:13: error: error.B not a member of error set 'Set2'
test/compile_errors/stage1/obj/explicitly_casting_non_tag_type_to_enum.zig+3-1
......@@ -11,6 +11,8 @@ export fn entry() void {
1111 _ = x;
1212}
1313
14// explicitly casting non tag type to enum
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:10:31: error: expected integer type, found 'f32'
test/compile_errors/stage1/obj/export_function_with_comptime_parameter.zig+3-1
......@@ -2,6 +2,8 @@ export fn foo(comptime x: i32, y: i32) i32{
22 return x + y;
33}
44
5// export function with comptime parameter
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C'
test/compile_errors/stage1/obj/export_generic_function.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo(num: anytype) i32 {
33 return 0;
44}
55
6// export generic function
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:1:15: error: parameter of type 'anytype' not allowed in function with calling convention 'C'
test/compile_errors/stage1/obj/exported_async_function.zig+3-1
......@@ -1,5 +1,7 @@
11export fn foo() callconv(.Async) void {}
22
3// exported async function
3// error
4// backend=stage1
5// target=native
46//
57// tmp.zig:1:1: error: exported function cannot be async
test/compile_errors/stage1/obj/exported_enum_without_explicit_integer_tag_type.zig+3-1
......@@ -7,7 +7,9 @@ comptime {
77 @export(e, .{ .name = "e" });
88}
99
10// exported enum without explicit integer tag type
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:13: error: exported enum without explicit integer tag type
1315// tmp.zig:7:13: error: exported enum value without explicit integer tag type
test/compile_errors/stage1/obj/extern_function_pointer_mismatch.zig+3-1
......@@ -5,6 +5,8 @@ export fn c(x: i32) i32 {return x + 2;}
55
66export fn entry() usize { return @sizeOf(@TypeOf(fns)); }
77
8// extern function pointer mismatch
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:1:37: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32'
test/compile_errors/stage1/obj/extern_function_with_comptime_parameter.zig+3-1
......@@ -4,6 +4,8 @@ fn f() i32 {
44}
55export fn entry() usize { return @sizeOf(@TypeOf(f)); }
66
7// extern function with comptime parameter
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C'
test/compile_errors/stage1/obj/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig+3-1
......@@ -36,6 +36,8 @@ export fn entry() void {
3636 _ = s;
3737}
3838
39// extern struct with extern-compatible but inferred integer tag type
39// error
40// backend=stage1
41// target=native
4042//
4143// tmp.zig:31:5: error: extern structs cannot contain fields of type 'E'
test/compile_errors/stage1/obj/extern_struct_with_non-extern-compatible_integer_tag_type.zig+3-1
......@@ -7,6 +7,8 @@ export fn entry() void {
77 _ = s;
88}
99
10// extern struct with non-extern-compatible integer tag type
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:5: error: extern structs cannot contain fields of type 'E'
test/compile_errors/stage1/obj/extern_union_field_missing_type.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 _ = a;
77}
88
9// extern union field missing type
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:2:5: error: union field missing type
test/compile_errors/stage1/obj/extern_union_given_enum_tag_type.zig+3-1
......@@ -13,6 +13,8 @@ export fn entry() void {
1313 _ = a;
1414}
1515
16// extern union given enum tag type
16// error
17// backend=stage1
18// target=native
1719//
1820// tmp.zig:6:30: error: extern union does not support enum tag type
test/compile_errors/stage1/obj/extern_variable_has_no_type.zig+3-1
......@@ -3,6 +3,8 @@ pub export fn entry() void {
33 foo;
44}
55
6// extern variable has no type
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:1:8: error: unable to infer variable type
test/compile_errors/stage1/obj/fieldParentPtr-bad_field_name.zig+3-1
......@@ -5,6 +5,8 @@ export fn foo(a: *i32) *Foo {
55 return @fieldParentPtr(Foo, "a", a);
66}
77
8// @fieldParentPtr - bad field name
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:33: error: struct 'Foo' has no field 'a'
test/compile_errors/stage1/obj/fieldParentPtr-comptime_field_ptr_not_based_on_struct.zig+3-1
......@@ -10,6 +10,8 @@ comptime {
1010 _ = another_foo_ptr;
1111}
1212
13// @fieldParentPtr - comptime field ptr not based on struct
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:9:55: error: pointer value not based on parent struct
test/compile_errors/stage1/obj/fieldParentPtr-comptime_wrong_field_index.zig+3-1
......@@ -9,6 +9,8 @@ comptime {
99 _ = another_foo_ptr;
1010}
1111
12// @fieldParentPtr - comptime wrong field index
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:8:29: error: field 'b' has index 1 but pointer value is index 0 of struct 'Foo'
test/compile_errors/stage1/obj/fieldParentPtr-field_pointer_is_not_pointer.zig+3-1
......@@ -5,6 +5,8 @@ export fn foo(a: i32) *Foo {
55 return @fieldParentPtr(Foo, "a", a);
66}
77
8// @fieldParentPtr - field pointer is not pointer
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:38: error: expected pointer, found 'i32'
test/compile_errors/stage1/obj/fieldParentPtr-non_struct.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo(a: *i32) *Foo {
33 return @fieldParentPtr(Foo, "a", a);
44}
55
6// @fieldParentPtr - non struct
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:28: error: expected struct type, found 'i32'
test/compile_errors/stage1/obj/field_access_of_opaque_type.zig+3-1
......@@ -9,6 +9,8 @@ fn bar(x: *MyType) bool {
99 return x.blah;
1010}
1111
12// field access of opaque type
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:9:13: error: no member named 'blah' in opaque type 'MyType'
test/compile_errors/stage1/obj/field_access_of_slices.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 _ = info;
55}
66
7// field access of slices
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:32: error: type 'type' does not support field access
test/compile_errors/stage1/obj/field_access_of_unknown_length_pointer.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry(foo: [*]Foo) void {
66 foo.a += 1;
77}
88
9// field access of unknown length pointer
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:6:8: error: type '[*]Foo' does not support field access
test/compile_errors/stage1/obj/field_type_supplied_in_an_enum.zig+3-1
......@@ -4,7 +4,9 @@ const Letter = enum {
44 C,
55};
66
7// field type supplied in an enum
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:2:8: error: enum fields do not have types
1012// tmp.zig:1:16: note: consider 'union(enum)' here to make it a tagged union
test/compile_errors/stage1/obj/floatToInt_comptime_safety.zig+3-1
......@@ -8,7 +8,9 @@ comptime {
88 _ = @floatToInt(u8, @as(f32, 256.1));
99}
1010
11// @floatToInt comptime safety
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:2:9: error: integer value '-129' cannot be stored in type 'i8'
1416// tmp.zig:5:9: error: integer value '-1' cannot be stored in type 'u8'
test/compile_errors/stage1/obj/float_literal_too_large_error.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a;
44}
55
6// float literal too large error
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: float literal out of range of any type
test/compile_errors/stage1/obj/float_literal_too_small_error_denormal.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a;
44}
55
6// float literal too small error (denormal)
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: float literal out of range of any type
test/compile_errors/stage1/obj/for_loop_body_expression_ignored.zig+3-1
......@@ -10,7 +10,9 @@ export fn f2() void {
1010 _ = x;
1111}
1212
13// for loop body expression ignored
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:5:30: error: expression value is ignored
1618// tmp.zig:9:30: error: expression value is ignored
test/compile_errors/stage1/obj/frame_called_outside_of_function_definition.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() bool {
44 return handle_undef == handle_dummy;
55}
66
7// @frame() called outside of function definition
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:2:30: error: @frame() called outside of function definition
test/compile_errors/stage1/obj/frame_causes_function_to_be_async.zig+3-1
......@@ -5,7 +5,9 @@ fn func() void {
55 _ = @frame();
66}
77
8// @frame() causes function to be async
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:1:1: error: function with calling convention 'C' cannot be async
1113// tmp.zig:5:9: note: @frame() causes function to be async
test/compile_errors/stage1/obj/function_alignment_non_power_of_2.zig+3-1
......@@ -1,6 +1,8 @@
11extern fn foo() align(3) void;
22export fn entry() void { return foo(); }
33
4// function alignment non power of 2
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:23: error: alignment value 3 is not a power of 2
test/compile_errors/stage1/obj/function_call_assigned_to_incorrect_type.zig+3-1
......@@ -6,6 +6,8 @@ fn concat() [16]f32 {
66 return [1]f32{0}**16;
77}
88
9// function call assigned to incorrect type
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:3:17: error: expected type '[4]f32', found '[16]f32'
test/compile_errors/stage1/obj/function_parameter_is_opaque.zig+3-1
......@@ -19,7 +19,9 @@ export fn entry4() void {
1919 _ = bar;
2020}
2121
22// function parameter is opaque
22// error
23// backend=stage1
24// target=native
2325//
2426// tmp.zig:3:28: error: parameter of opaque type 'FooType' not allowed
2527// tmp.zig:8:28: error: parameter of type '@Type(.Null)' not allowed
test/compile_errors/stage1/obj/function_prototype_with_no_body.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 foo();
44}
55
6// function prototype with no body
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:1:1: error: non-extern function has no body
test/compile_errors/stage1/obj/function_returning_opaque_type.zig+3-1
......@@ -9,7 +9,9 @@ export fn baz() !@TypeOf(undefined) {
99 return error.InvalidValue;
1010}
1111
12// function returning opaque type
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:2:18: error: Opaque return type 'FooType' not allowed
1517// tmp.zig:1:1: note: type declared here
test/compile_errors/stage1/obj/function_with_ccc_indirectly_calling_async_function.zig+3-1
......@@ -8,7 +8,9 @@ fn bar() void {
88 suspend {}
99}
1010
11// function with ccc indirectly calling async function
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:1:1: error: function with calling convention 'C' cannot be async
1416// tmp.zig:2:8: note: async function call here
test/compile_errors/stage1/obj/function_with_invalid_return_type.zig+3-1
......@@ -1,5 +1,7 @@
11export fn foo() boid {}
22
3// function with invalid return type
3// error
4// backend=stage1
5// target=native
46//
57// tmp.zig:1:17: error: use of undeclared identifier 'boid'
test/compile_errors/stage1/obj/function_with_non-extern_non-packed_enum_parameter.zig+3-1
......@@ -1,6 +1,8 @@
11const Foo = enum { A, B, C };
22export fn entry(foo: Foo) void { _ = foo; }
33
4// function with non-extern non-packed enum parameter
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:2:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C'
test/compile_errors/stage1/obj/function_with_non-extern_non-packed_struct_parameter.zig+3-1
......@@ -5,6 +5,8 @@ const Foo = struct {
55};
66export fn entry(foo: Foo) void { _ = foo; }
77
8// function with non-extern non-packed struct parameter
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C'
test/compile_errors/stage1/obj/function_with_non-extern_non-packed_union_parameter.zig+3-1
......@@ -5,6 +5,8 @@ const Foo = union {
55};
66export fn entry(foo: Foo) void { _ = foo; }
77
8// function with non-extern non-packed union parameter
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C'
test/compile_errors/stage1/obj/generic_fn_as_parameter_without_comptime_keyword.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 f(g);
55}
66
7// generic fn as parameter without comptime keyword
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:1:9: error: parameter of type 'fn(anytype) anytype' must be declared comptime
test/compile_errors/stage1/obj/generic_function_call_assigned_to_incorrect_type.zig+3-1
......@@ -6,6 +6,8 @@ fn myAlloc(comptime arg: type) anyerror!arg{
66 unreachable;
77}
88
9// generic function call assigned to incorrect type
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:3:18: error: expected type '[]i32', found 'anyerror!i32
test/compile_errors/stage1/obj/generic_function_instance_with_non-constant_expression.zig+3-1
......@@ -5,6 +5,8 @@ fn test1(a: i32, b: i32) i32 {
55
66export fn entry() usize { return @sizeOf(@TypeOf(test1)); }
77
8// generic function instance with non-constant expression
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:16: error: runtime value cannot be passed to comptime arg
test/compile_errors/stage1/obj/generic_function_returning_opaque_type.zig+3-1
......@@ -12,7 +12,9 @@ export fn baz() void {
1212 _ = generic(@TypeOf(undefined));
1313}
1414
15// generic function returning opaque type
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed
1820// tmp.zig:2:1: note: function declared here
test/compile_errors/stage1/obj/generic_function_where_return_type_is_self-referenced.zig+3-1
......@@ -8,6 +8,8 @@ export fn entry() void {
88 _ = t;
99}
1010
11// generic function where return type is self-referenced
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches
test/compile_errors/stage1/obj/global_variable_alignment_non_power_of_2.zig+3-1
......@@ -1,6 +1,8 @@
11const some_data: [100]u8 align(3) = undefined;
22export fn entry() usize { return @sizeOf(@TypeOf(some_data)); }
33
4// global variable alignment non power of 2
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:32: error: alignment value 3 is not a power of 2
test/compile_errors/stage1/obj/global_variable_initializer_must_be_constant_expression.zig+3-1
......@@ -2,6 +2,8 @@ extern fn foo() i32;
22const x = foo();
33export fn entry() i32 { return x; }
44
5// global variable initializer must be constant expression
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:11: error: unable to evaluate constant expression
test/compile_errors/stage1/obj/hasDecl_with_non-container.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 _ = @hasDecl(i32, "hi");
33}
44
5// @hasDecl with non-container
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:18: error: expected struct, enum, or union; found 'i32'
test/compile_errors/stage1/obj/if_condition_is_bool_not_int.zig+3-1
......@@ -2,6 +2,8 @@ export fn f() void {
22 if (0) {}
33}
44
5// if condition is bool, not int
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:9: error: expected type 'bool', found 'comptime_int'
test/compile_errors/stage1/obj/ignored_assert-err-ok_return_value.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33}
44fn bar() anyerror!i32 { return 0; }
55
6// ignored assert-err-ok return value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:11: error: expression value is ignored
test/compile_errors/stage1/obj/ignored_comptime_statement_value.zig+3-1
......@@ -2,6 +2,8 @@ export fn foo() void {
22 comptime {1;}
33}
44
5// ignored comptime statement value
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:15: error: expression value is ignored
test/compile_errors/stage1/obj/ignored_comptime_value.zig+3-1
......@@ -2,6 +2,8 @@ export fn foo() void {
22 comptime 1;
33}
44
5// ignored comptime value
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: expression value is ignored
test/compile_errors/stage1/obj/ignored_deferred_function_call.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33}
44fn bar() anyerror!i32 { return 0; }
55
6// ignored deferred function call
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:14: error: error is ignored. consider using `try`, `catch`, or `if`
test/compile_errors/stage1/obj/ignored_deferred_statement_value.zig+3-1
......@@ -2,6 +2,8 @@ export fn foo() void {
22 defer {1;}
33}
44
5// ignored deferred statement value
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:12: error: expression value is ignored
test/compile_errors/stage1/obj/ignored_expression_in_while_continuation.zig+3-1
......@@ -13,7 +13,9 @@ fn bad() anyerror!void {
1313 return error.Bad;
1414}
1515
16// ignored expression in while continuation
16// error
17// backend=stage1
18// target=native
1719//
1820// tmp.zig:2:24: error: error is ignored. consider using `try`, `catch`, or `if`
1921// tmp.zig:6:25: error: error is ignored. consider using `try`, `catch`, or `if`
test/compile_errors/stage1/obj/ignored_return_value.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33}
44fn bar() i32 { return 0; }
55
6// ignored return value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:8: error: expression value is ignored
test/compile_errors/stage1/obj/ignored_statement_value.zig+3-1
......@@ -2,6 +2,8 @@ export fn foo() void {
22 1;
33}
44
5// ignored statement value
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: expression value is ignored
test/compile_errors/stage1/obj/illegal_comparison_of_types.zig+3-1
......@@ -12,7 +12,9 @@ fn bad_eql_2(a: *const EnumWithData, b: *const EnumWithData) bool {
1212export fn entry1() usize { return @sizeOf(@TypeOf(bad_eql_1)); }
1313export fn entry2() usize { return @sizeOf(@TypeOf(bad_eql_2)); }
1414
15// illegal comparison of types
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:2:14: error: operator not allowed for type '[]u8'
1820// tmp.zig:9:16: error: operator not allowed for type 'EnumWithData'
test/compile_errors/stage1/obj/implicit_cast_between_C_pointer_and_Zig_pointer-bad_const-align-child.zig+3-1
......@@ -29,7 +29,9 @@ export fn f() void {
2929 _ = x;
3030}
3131
32// implicit cast between C pointer and Zig pointer - bad const/align/child
32// error
33// backend=stage1
34// target=native
3335//
3436// tmp.zig:3:27: error: cast increases pointer alignment
3537// tmp.zig:8:18: error: cast discards const qualifier
test/compile_errors/stage1/obj/implicit_cast_const_array_to_mutable_slice.zig+3-1
......@@ -4,7 +4,9 @@ export fn entry() void {
44 _ = sliceA;
55}
66
7// implicit cast const array to mutable slice
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:27: error: cannot cast pointer to array literal to slice type '[]u8'
1012// tmp.zig:3:27: note: cast discards const qualifier
test/compile_errors/stage1/obj/implicit_cast_from_array_to_mutable_slice.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 foo(global_array);
55}
66
7// implicit cast from array to mutable slice
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:4:9: error: expected type '[]i32', found '[10]i32'
test/compile_errors/stage1/obj/implicit_cast_from_f64_to_f32.zig+3-1
......@@ -3,6 +3,8 @@ var y: f32 = x;
33
44export fn entry() usize { return @sizeOf(@TypeOf(y)); }
55
6// implicit cast from f64 to f32
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:14: error: expected type 'f32', found 'f64'
test/compile_errors/stage1/obj/implicit_cast_of_error_set_not_a_subset.zig+3-1
......@@ -8,7 +8,9 @@ fn foo(set1: Set1) void {
88 _ = x;
99}
1010
11// implicit cast of error set not a subset
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:7:19: error: expected type 'Set2', found 'Set1'
1416// tmp.zig:1:23: note: 'error.B' not a member of destination error set
test/compile_errors/stage1/obj/implicit_casting_C_pointers_which_would_mess_up_null_semantics.zig+3-1
......@@ -14,7 +14,9 @@ export fn entry2() void {
1414 _ = c_ptr;
1515}
1616
17// implicit casting C pointers which would mess up null semantics
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:6:24: error: expected type '*const [*]const u8', found '[*c]const [*c]const u8'
2022// tmp.zig:6:24: note: pointer type child '[*c]const u8' cannot cast into pointer type child '[*]const u8'
test/compile_errors/stage1/obj/implicit_casting_null_c_pointer_to_zig_pointer.zig+3-1
......@@ -4,6 +4,8 @@ comptime {
44 _ = zig_ptr;
55}
66
7// implicit casting null c pointer to zig pointer
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:24: error: null pointer casted to type '*u8'
test/compile_errors/stage1/obj/implicit_casting_too_big_integers_to_C_pointers.zig+3-1
......@@ -8,7 +8,9 @@ export fn b() void {
88 _ = ptr;
99}
1010
11// implicit casting too big integers to C pointers
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:2:33: error: integer value 18446744073709551617 cannot be coerced to type 'usize'
1416// tmp.zig:7:23: error: integer type 'u65' too big for implicit @intToPtr to type '[*c]u8'
test/compile_errors/stage1/obj/implicit_casting_undefined_c_pointer_to_zig_pointer.zig+3-1
......@@ -4,6 +4,8 @@ comptime {
44 _ = zig_ptr;
55}
66
7// implicit casting undefined c pointer to zig pointer
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:24: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/implicit_dependency_on_libc.zig created+11
......@@ -0,0 +1,11 @@
1extern "c" fn exit(u8) void;
2export fn entry() void {
3 exit(0);
4}
5
6// error
7// backend=stage1
8// target=native-linux
9// is_test=1
10//
11// tmp.zig:3:5: error: dependency on libc must be explicitly specified in the build command
test/compile_errors/stage1/obj/implicit_semicolon-block_expr.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - block expr
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:11: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-block_statement.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - block statement
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:9: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-comptime_expression.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - comptime expression
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:20: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-comptime_statement.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - comptime statement
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:18: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-defer.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - defer
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:15: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-for_expression.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - for expression
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:26: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-for_statement.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - for statement
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:24: error: expected ';' or 'else' after statement
test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_expression.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - if-else-if-else expression
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:45: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-if-else-if-else_statement.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - if-else-if-else statement
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:47: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_expression.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - if-else-if expression
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:37: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-if-else-if_statement.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - if-else-if statement
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:37: error: expected ';' or 'else' after statement
test/compile_errors/stage1/obj/implicit_semicolon-if-else_expression.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - if-else expression
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:28: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-if-else_statement.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - if-else statement
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:28: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-if_expression.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - if expression
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:20: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-if_statement.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - if statement
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:18: error: expected ';' or 'else' after statement
test/compile_errors/stage1/obj/implicit_semicolon-test_expression.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - test expression
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:26: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-test_statement.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - test statement
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:24: error: expected ';' or 'else' after statement
test/compile_errors/stage1/obj/implicit_semicolon-while-continue_expression.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - while-continue expression
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:28: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-while-continue_statement.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - while-continue statement
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:26: error: expected ';' or 'else' after statement
test/compile_errors/stage1/obj/implicit_semicolon-while_expression.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - while expression
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:23: error: expected ';' after statement
test/compile_errors/stage1/obj/implicit_semicolon-while_statement.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 var bad = {};
66}
77
8// implicit semicolon - while statement
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:18: error: expected ';' or 'else' after statement
test/compile_errors/stage1/obj/implicitly_casting_enum_to_tag_type.zig+3-1
......@@ -10,6 +10,8 @@ export fn entry() void {
1010 _ = x;
1111}
1212
13// implicitly casting enum to tag type
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:9:22: error: expected type 'u2', found 'Small'
test/compile_errors/stage1/obj/implicitly_increasing_pointer_alignment.zig+3-1
......@@ -12,6 +12,8 @@ fn bar(x: *u32) void {
1212 x.* += 1;
1313}
1414
15// implicitly increasing pointer alignment
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:8:13: error: expected type '*u32', found '*align(1) u32'
test/compile_errors/stage1/obj/implicitly_increasing_slice_alignment.zig+3-1
......@@ -13,7 +13,9 @@ fn bar(x: []u32) void {
1313 x[0] += 1;
1414}
1515
16// implicitly increasing slice alignment
16// error
17// backend=stage1
18// target=native
1719//
1820// tmp.zig:9:26: error: cast increases pointer alignment
1921// tmp.zig:9:26: note: '*align(1) u32' has alignment 1
test/compile_errors/stage1/obj/import_outside_package_path.zig+3-1
......@@ -2,6 +2,8 @@ comptime{
22 _ = @import("../a.zig");
33}
44
5// import outside package path
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:9: error: import of file outside package path: '../a.zig'
test/compile_errors/stage1/obj/incompatible_sentinels.zig created+29
......@@ -0,0 +1,29 @@
1// Note: One of the error messages here is backwards. It would be nice to fix, but that's not
2// going to stop me from merging this branch which fixes a bunch of other stuff.
3export fn entry1(ptr: [*:255]u8) [*:0]u8 {
4 return ptr;
5}
6export fn entry2(ptr: [*]u8) [*:0]u8 {
7 return ptr;
8}
9export fn entry3() void {
10 var array: [2:0]u8 = [_:255]u8{ 1, 2 };
11 _ = array;
12}
13export fn entry4() void {
14 var array: [2:0]u8 = [_]u8{ 1, 2 };
15 _ = array;
16}
17
18// error
19// backend=stage1
20// target=native
21//
22// tmp.zig:4:12: error: expected type '[*:0]u8', found '[*:255]u8'
23// tmp.zig:4:12: note: destination pointer requires a terminating '0' sentinel, but source pointer has a terminating '255' sentinel
24// tmp.zig:7:12: error: expected type '[*:0]u8', found '[*]u8'
25// tmp.zig:7:12: note: destination pointer requires a terminating '0' sentinel
26// tmp.zig:10:35: error: expected type '[2:255]u8', found '[2:0]u8'
27// tmp.zig:10:35: note: destination array requires a terminating '255' sentinel, but source array has a terminating '0' sentinel
28// tmp.zig:14:31: error: expected type '[2:0]u8', found '[2]u8'
29// tmp.zig:14:31: note: destination array requires a terminating '0' sentinel
test/compile_errors/stage1/obj/incorrect_return_type.zig+3-1
......@@ -14,6 +14,8 @@
1414 unreachable;
1515 }
1616
17// incorrect return type
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:8:16: error: expected type 'A', found 'B'
test/compile_errors/stage1/obj/increase_pointer_alignment_in_ptrCast.zig+3-1
......@@ -4,7 +4,9 @@ export fn entry() u32 {
44 return ptr.*;
55}
66
7// increase pointer alignment in @ptrCast
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:17: error: cast increases pointer alignment
1012// tmp.zig:3:38: note: '*u8' has alignment 1
test/compile_errors/stage1/obj/indexing_a_undefined_slice_at_comptime.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 slice[0] = 2;
44}
55
6// indexing a undefined slice at comptime
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:10: error: index 0 outside slice of size 0
test/compile_errors/stage1/obj/indexing_an_array_of_size_zero.zig+3-1
......@@ -4,6 +4,8 @@ export fn foo() void {
44 _ = pointer;
55}
66
7// indexing an array of size zero
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:27: error: accessing a zero length array is not allowed
test/compile_errors/stage1/obj/indexing_an_array_of_size_zero_with_runtime_index.zig+3-1
......@@ -5,6 +5,8 @@ export fn foo() void {
55 _ = pointer;
66}
77
8// indexing an array of size zero with runtime index
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:27: error: accessing a zero length array is not allowed
test/compile_errors/stage1/obj/indexing_single-item_pointer.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry(ptr: *i32) i32 {
22 return ptr[1];
33}
44
5// indexing single-item pointer
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:15: error: index of single-item pointer
test/compile_errors/stage1/obj/indirect_recursion_of_async_functions_detected.zig+3-1
......@@ -27,7 +27,9 @@ fn rangeSumIndirect(x: i32) i32 {
2727 return child + 1;
2828}
2929
30// indirect recursion of async functions detected
30// error
31// backend=stage1
32// target=native
3133//
3234// tmp.zig:8:1: error: '@Frame(rangeSum)' depends on itself
3335// tmp.zig:15:33: note: when analyzing type '@Frame(rangeSum)' here
test/compile_errors/stage1/obj/indirect_struct_loop.zig+3-1
......@@ -3,6 +3,8 @@ const B = struct { c : C, };
33const C = struct { a : A, };
44export fn entry() usize { return @sizeOf(A); }
55
6// indirect struct loop
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:1:11: error: struct 'A' depends on itself
test/compile_errors/stage1/obj/inferred_array_size_invalid_here.zig+3-1
......@@ -8,7 +8,9 @@ export fn entry2() void {
88 _ = a;
99}
1010
11// inferred array size invalid here
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:2:16: error: unable to infer array size
1416// tmp.zig:6:35: error: unable to infer array size
test/compile_errors/stage1/obj/inferring_error_set_of_function_pointer.zig+3-1
......@@ -2,6 +2,8 @@ comptime {
22 const z: ?fn()!void = null;
33}
44
5// inferring error set of function pointer
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:19: error: function prototype may not have inferred error set
test/compile_errors/stage1/obj/initializing_array_with_struct_syntax.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// initializing array with struct syntax
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: initializing array with struct syntax
test/compile_errors/stage1/obj/instantiating_an_undefined_value_for_an_invalid_struct_that_contains_itself.zig+3-1
......@@ -8,6 +8,8 @@ export fn entry() usize {
88 return @sizeOf(@TypeOf(foo.x));
99}
1010
11// instantiating an undefined value for an invalid struct that contains itself
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:1:13: error: struct 'Foo' depends on itself
test/compile_errors/stage1/obj/intToPtr_with_misaligned_address.zig+3-1
......@@ -3,6 +3,8 @@ pub fn main() void {
33 _ = y;
44}
55
6// intToPtr with misaligned address
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:13: error: pointer type '[*]align(4) u8' requires aligned address
test/compile_errors/stage1/obj/int_to_err_global_invalid_number.zig+3-1
......@@ -8,6 +8,8 @@ comptime {
88 _ = y;
99}
1010
11// int to err global invalid number
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:7:13: error: integer value 3 represents no error
test/compile_errors/stage1/obj/int_to_err_non_global_invalid_number.zig+3-1
......@@ -12,6 +12,8 @@ comptime {
1212 _ = y;
1313}
1414
15// int to err non global invalid number
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:11:13: error: error.B not a member of error set 'Set2'
test/compile_errors/stage1/obj/int_to_ptr_of_0_bits.zig+3-1
......@@ -4,6 +4,8 @@ export fn foo() void {
44 _ = y;
55}
66
7// int to ptr of 0 bits
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:30: error: type '*void' has 0 bits and cannot store information
test/compile_errors/stage1/obj/integer_cast_truncates_bits.zig+3-1
......@@ -19,7 +19,9 @@ export fn entry4() void {
1919 _ = unsigned;
2020}
2121
22// integer cast truncates bits
22// error
23// backend=stage1
24// target=native
2325//
2426// tmp.zig:3:18: error: cast from 'u16' to 'u8' truncates bits
2527// tmp.zig:8:22: error: integer value 300 cannot be coerced to type 'u8'
test/compile_errors/stage1/obj/integer_overflow_error.zig+3-1
......@@ -1,6 +1,8 @@
11const x : u8 = 300;
22export fn entry() usize { return @sizeOf(@TypeOf(x)); }
33
4// integer overflow error
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:16: error: integer value 300 cannot be coerced to type 'u8'
test/compile_errors/stage1/obj/integer_underflow_error.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 _ = @intToPtr(*anyopaque, ~@as(usize, @import("std").math.maxInt(usize)) - 1);
33}
44
5// integer underflow error
5// error
6// backend=stage1
7// target=native
68//
79// :2:78: error: operation caused overflow
test/compile_errors/stage1/obj/invalid_break_expression.zig+3-1
......@@ -2,6 +2,8 @@ export fn f() void {
22 break;
33}
44
5// invalid break expression
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: break expression outside loop
test/compile_errors/stage1/obj/invalid_builtin_fn.zig+3-1
......@@ -2,6 +2,8 @@ fn f() @bogus(foo) {
22}
33export fn entry() void { _ = f(); }
44
5// invalid builtin fn
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:1:8: error: invalid builtin function: '@bogus'
test/compile_errors/stage1/obj/invalid_cast_from_integral_type_to_enum.zig+3-1
......@@ -10,6 +10,8 @@ fn foo(x: usize) void {
1010 }
1111}
1212
13// invalid cast from integral type to enum
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:9:10: error: expected type 'usize', found 'E'
test/compile_errors/stage1/obj/invalid_comparison_for_function_pointers.zig+3-1
......@@ -3,6 +3,8 @@ const invalid = foo > foo;
33
44export fn entry() usize { return @sizeOf(@TypeOf(invalid)); }
55
6// invalid comparison for function pointers
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: operator not allowed for type 'fn() void'
test/compile_errors/stage1/obj/invalid_continue_expression.zig+3-1
......@@ -2,6 +2,8 @@ export fn f() void {
22 continue;
33}
44
5// invalid continue expression
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: continue expression outside loop
test/compile_errors/stage1/obj/invalid_deref_on_switch_target.zig+3-1
......@@ -10,6 +10,8 @@ const Tile = enum {
1010 Filled,
1111};
1212
13// invalid deref on switch target
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:3:17: error: attempt to dereference non-pointer type 'Tile'
test/compile_errors/stage1/obj/invalid_empty_unicode_escape.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 const a = '\u{}';
33}
44
5// invalid empty unicode escape
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:19: error: empty unicode escape sequence
test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-1.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid exponent in float literal - 1
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:28: note: invalid byte: 'a'
test/compile_errors/stage1/obj/invalid_exponent_in_float_literal-2.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid exponent in float literal - 2
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:29: note: invalid byte: 'F'
test/compile_errors/stage1/obj/invalid_field_access_in_comptime.zig+3-1
......@@ -1,5 +1,7 @@
11comptime { var x = doesnt_exist.whatever; _ = x; }
22
3// invalid field access in comptime
3// error
4// backend=stage1
5// target=native
46//
57// tmp.zig:1:20: error: use of undeclared identifier 'doesnt_exist'
test/compile_errors/stage1/obj/invalid_field_in_struct_value_expression.zig+3-1
......@@ -12,6 +12,8 @@ export fn f() void {
1212 _ = a;
1313}
1414
15// invalid field in struct value expression
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:10:9: error: no member named 'foo' in struct 'A'
test/compile_errors/stage1/obj/invalid_float_literal.zig+3-1
......@@ -6,6 +6,8 @@ pub fn main() void {
66 std.debug.assert(bad_float < 1.0);
77}
88
9// invalid float literal
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:29: error: expected expression, found '.'
test/compile_errors/stage1/obj/invalid_legacy_unicode_escape.zig+3-1
......@@ -2,7 +2,9 @@ export fn entry() void {
22 const a = '\U1234';
33}
44
5// invalid legacy unicode escape
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:15: error: expected expression, found 'invalid bytes'
810// tmp.zig:2:18: note: invalid byte: '1'
test/compile_errors/stage1/obj/invalid_maybe_type.zig+3-1
......@@ -2,6 +2,8 @@ export fn f() void {
22 if (true) |x| { _ = x; }
33}
44
5// invalid maybe type
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:9: error: expected optional type, found 'bool'
test/compile_errors/stage1/obj/invalid_member_of_builtin_enum.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 _ = foo;
55}
66
7// invalid member of builtin enum
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:29: error: container 'std.builtin.Mode' has no member called 'x86'
test/compile_errors/stage1/obj/invalid_multiple_dereferences.zig+3-1
......@@ -11,7 +11,9 @@ pub const Box = struct {
1111 field: i32,
1212};
1313
14// invalid multiple dereferences
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:3:8: error: attempt to dereference non-pointer type 'Box'
1719// tmp.zig:8:13: error: attempt to dereference non-pointer type 'Box'
test/compile_errors/stage1/obj/invalid_optional_type_in_extern_struct.zig+3-1
......@@ -3,6 +3,8 @@ const stroo = extern struct {
33};
44export fn testf(fluff: *stroo) void { _ = fluff; }
55
6// invalid optional type in extern struct
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:5: error: extern structs cannot contain fields of type '?[*c]u8'
test/compile_errors/stage1/obj/invalid_pointer_for_var_type.zig+3-1
......@@ -6,6 +6,8 @@ export fn f() void {
66 }
77}
88
9// invalid pointer for var type
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:2:13: error: unable to evaluate constant expression
test/compile_errors/stage1/obj/invalid_pointer_syntax.zig+3-1
......@@ -2,6 +2,8 @@ export fn foo() void {
22 var guid: *:0 const u8 = undefined;
33}
44
5// invalid pointer syntax
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:16: error: expected type expression, found ':'
test/compile_errors/stage1/obj/invalid_shift_amount_error.zig+3-1
......@@ -4,6 +4,8 @@ fn f() u16 {
44}
55export fn entry() u16 { return f(); }
66
7// invalid shift amount error
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:17: error: integer value 8 cannot be coerced to type 'u3'
test/compile_errors/stage1/obj/invalid_struct_field.zig+3-1
......@@ -11,7 +11,9 @@ export fn g() void {
1111 _ = y;
1212}
1313
14// invalid struct field
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:4:6: error: no member named 'foo' in struct 'A'
1719// tmp.zig:10:16: error: no member named 'bar' in struct 'A'
test/compile_errors/stage1/obj/invalid_suspend_in_exported_function.zig+3-1
......@@ -7,7 +7,9 @@ fn func() void {
77 suspend {}
88}
99
10// invalid suspend in exported function
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:1:1: error: function with calling convention 'C' cannot be async
1315// tmp.zig:3:18: note: await here is a suspend point
test/compile_errors/stage1/obj/invalid_type.zig+3-1
......@@ -1,6 +1,8 @@
11fn a() bogus {}
22export fn entry() void { _ = a(); }
33
4// invalid type
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:8: error: use of undeclared identifier 'bogus'
test/compile_errors/stage1/obj/invalid_type_used_in_array_type.zig+3-1
......@@ -7,6 +7,8 @@ export fn entry() void {
77 _ = a;
88}
99
10// invalid type used in array type
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:2:12: error: use of undeclared identifier 'SomeNonexistentType'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-1.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 1
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:23: note: invalid byte: '_'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-10.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 10
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:25: note: invalid byte: '_'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-11.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 11
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:28: note: invalid byte: '_'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-12.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 12
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:23: note: invalid byte: 'x'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-13.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 13
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:23: note: invalid byte: '_'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-14.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 14
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:27: note: invalid byte: 'p'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-2.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 2
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:23: note: invalid byte: '.'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-3.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 3
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:25: note: invalid byte: ';'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-4.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 4
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:25: note: invalid byte: '_'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-5.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 5
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:26: note: invalid byte: '_'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-6.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 6
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:26: note: invalid byte: '_'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-7.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 7
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:28: note: invalid byte: ';'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_float_literal-9.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in float literal - 9
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:23: note: invalid byte: '_'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-1.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in int literal - 1
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:26: note: invalid byte: ';'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-2.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in int literal - 2
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:28: note: invalid byte: ';'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-3.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in int literal - 3
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:28: note: invalid byte: ';'
test/compile_errors/stage1/obj/invalid_underscore_placement_in_int_literal-4.zig+3-1
......@@ -3,7 +3,9 @@ fn main() void {
33 _ = bad;
44}
55
6// invalid underscore placement in int literal - 4
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
911// tmp.zig:2:28: note: invalid byte: ';'
test/compile_errors/stage1/obj/invalid_union_field_access_in_comptime.zig+3-1
......@@ -8,6 +8,8 @@ comptime {
88 _ = bar_val;
99}
1010
11// invalid union field access in comptime
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:7:24: error: accessing union field 'Bar' while field 'Baz' is set
test/compile_errors/stage1/obj/issue_2032_compile_diagnostic_string_for_top_level_decl_type.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = foo;
44}
55
6// compile diagnostic string for top level decl type (issue 2032)
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:27: error: type 'u32' does not support array initialization
test/compile_errors/stage1/obj/issue_2687_coerce_from_undefined_array_pointer_to_slice.zig+3-1
......@@ -18,7 +18,9 @@ export fn foo3() void {
1818 }
1919}
2020
21// issue #2687: coerce from undefined array pointer to slice
21// error
22// backend=stage1
23// target=native
2224//
2325// tmp.zig:3:19: error: use of undefined value here causes undefined behavior
2426// tmp.zig:9:23: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/issue_3818_bitcast_from_parray-slice_to_u16.zig+3-1
......@@ -9,7 +9,9 @@ export fn foo2() void {
99 _ = word;
1010}
1111
12// issue #3818: bitcast from parray/slice to u16
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:3:42: error: unable to @bitCast from pointer type '*[2]u8'
1517// tmp.zig:8:32: error: destination type 'u16' has size 2 but source type '[]const u8' has size 16
test/compile_errors/stage1/obj/issue_4207_coerce_from_non-terminated-slice_to_terminated-pointer.zig+3-1
......@@ -3,7 +3,9 @@ export fn foo() [*:0]const u8 {
33 return buffer[0..];
44}
55
6// issue #4207: coerce from non-terminated-slice to terminated-pointer
6// error
7// backend=stage1
8// target=native
79//
810// :3:18: error: expected type '[*:0]const u8', found '*[64]u8'
911// :3:18: note: destination pointer requires a terminating '0' sentinel
test/compile_errors/stage1/obj/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig+3-1
......@@ -8,7 +8,9 @@ export fn foo() void {
88 comptime ignore(@typeInfo(MyStruct).Struct.fields[0]);
99}
1010
11// issue #5221: invalid struct init type referenced by @typeInfo and passed into function
11// error
12// backend=stage1
13// target=native
1214//
1315// :5:28: error: cannot cast pointer to array literal to slice type '[]u8'
1416// :5:28: note: cast discards const qualifier
test/compile_errors/stage1/obj/issue_5618_coercion_of_optional_anyopaque_to_anyopaque_must_fail.zig+3-1
......@@ -4,6 +4,8 @@ export fn foo() void {
44 v = u;
55}
66
7// Issue #5618: coercion of ?*anyopaque to *anyopaque must fail.
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:4:9: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type '*anyopaque', found '?*anyopaque'
test/compile_errors/stage1/obj/issue_7810-comptime_slice-len_increment_beyond_bounds.zig+3-1
......@@ -7,6 +7,8 @@ export fn foo_slice_len_increment_beyond_bounds() void {
77 }
88}
99
10// comptime slice-len increment beyond bounds
10// error
11// backend=stage1
12// target=native
1113//
1214// :6:12: error: out of bounds slice
test/compile_errors/stage1/obj/issue_9346_return_outside_of_function_scope.zig+3-1
......@@ -1,5 +1,7 @@
11pub const empty = return 1;
22
3// issue #9346: return outside of function scope
3// error
4// backend=stage1
5// target=native
46//
57// tmp.zig:1:19: error: 'return' outside function scope
test/compile_errors/stage1/obj/labeled_break_not_found.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 }
77}
88
9// labeled break not found
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:4:20: error: label not found: 'outer'
test/compile_errors/stage1/obj/labeled_continue_not_found.zig+3-1
......@@ -7,6 +7,8 @@ export fn entry() void {
77 }
88}
99
10// labeled continue not found
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:5:23: error: label not found: 'outer'
test/compile_errors/stage1/obj/lazy_pointer_with_undefined_element_type.zig+3-1
......@@ -5,6 +5,8 @@ export fn foo() void {
55 _ = I;
66}
77
8// lazy pointer with undefined element type
8// error
9// backend=stage1
10// target=native
911//
1012// :3:28: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/libc_headers_note.zig created+12
......@@ -0,0 +1,12 @@
1const c = @cImport(@cInclude("stdio.h"));
2export fn entry() void {
3 _ = c.printf("hello, world!\n");
4}
5
6// error
7// backend=stage1
8// is_test=1
9// target=native-linux
10//
11// tmp.zig:1:11: error: C import failed
12// tmp.zig:1:11: note: libc headers not available; compilation does not link against libc
test/compile_errors/stage1/obj/load_too_many_bytes_from_comptime_reinterpreted_pointer.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 _ = int_val;
77}
88
9// load too many bytes from comptime reinterpreted pointer
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:28: error: attempt to read 8 bytes from pointer to f32 which is 4 bytes
test/compile_errors/stage1/obj/load_vector_pointer_with_unknown_runtime_index.zig+3-1
......@@ -10,6 +10,8 @@ fn loadv(ptr: anytype) i32 {
1010 return ptr.*;
1111}
1212
13// load vector pointer with unknown runtime index
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:10:12: error: unable to determine vector element index of type '*align(16:0:4:?) i32
test/compile_errors/stage1/obj/local_shadows_global_that_occurs_later.zig+3-1
......@@ -4,7 +4,9 @@ pub fn main() void {
44}
55fn foo() void {}
66
7// local shadows global that occurs later
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:2:9: error: local shadows declaration of 'foo'
1012// tmp.zig:5:1: note: declared here
test/compile_errors/stage1/obj/local_variable_redeclaration.zig+3-1
......@@ -3,7 +3,9 @@ export fn f() void {
33 var a = 0;
44}
55
6// local variable redeclaration
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: redeclaration of local constant 'a'
911// tmp.zig:2:11: note: previous declaration here
test/compile_errors/stage1/obj/local_variable_redeclares_parameter.zig+3-1
......@@ -3,7 +3,9 @@ fn f(a : i32) void {
33}
44export fn entry() void { f(1); }
55
6// local variable redeclares parameter
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:11: error: redeclaration of function parameter 'a'
911// tmp.zig:1:6: note: previous declaration here
test/compile_errors/stage1/obj/local_variable_shadowing_global.zig+3-1
......@@ -6,7 +6,9 @@ export fn entry() void {
66 _ = Bar;
77}
88
9// local variable shadowing global
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:9: error: local shadows declaration of 'Bar'
1214// tmp.zig:2:1: note: declared here
test/compile_errors/stage1/obj/locally_shadowing_a_primitive_type.zig+3-1
......@@ -4,7 +4,9 @@ export fn foo() void {
44 _ = a;
55}
66
7// locally shadowing a primitive type
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:2:11: error: name shadows primitive 'u8'
1012// tmp.zig:2:11: note: consider using @"u8" to disambiguate
test/compile_errors/stage1/obj/main_function_with_bogus_args_type.zig+3-1
......@@ -1,5 +1,7 @@
11pub fn main(args: [][]bogus) !void {_ = args;}
22
3// main function with bogus args type
3// error
4// backend=stage1
5// target=native
46//
57// tmp.zig:1:23: error: use of undeclared identifier 'bogus'
test/compile_errors/stage1/obj/method_call_with_first_arg_type_primitive.zig+3-1
......@@ -14,6 +14,8 @@ export fn f() void {
1414 derp.init();
1515}
1616
17// method call with first arg type primitive
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:14:5: error: expected type 'i32', found 'Foo'
test/compile_errors/stage1/obj/method_call_with_first_arg_type_wrong_container.zig+3-1
......@@ -23,6 +23,8 @@ export fn foo() void {
2323 x.init();
2424}
2525
26// method call with first arg type wrong container
26// error
27// backend=stage1
28// target=native
2729//
2830// tmp.zig:23:5: error: expected type '*Allocator', found '*List'
test/compile_errors/stage1/obj/missing_boolean_switch_value.zig+3-1
......@@ -11,7 +11,9 @@ comptime {
1111 _ = x;
1212}
1313
14// missing boolean switch value
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:2:15: error: switch must handle all possibilities
1719// tmp.zig:8:15: error: switch must handle all possibilities
test/compile_errors/stage1/obj/missing_const_in_slice_with_nested_array_type.zig+3-1
......@@ -11,6 +11,8 @@ export fn entry() void {
1111 _ = geo_data;
1212}
1313
14// missing const in slice with nested array type
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:4:30: error: array literal requires address-of operator (&) to coerce to slice type '[][2]f32'
test/compile_errors/stage1/obj/missing_else_clause.zig+3-1
......@@ -8,7 +8,9 @@ fn g(b: bool) void {
88}
99export fn entry() void { f(true); g(true); }
1010
11// missing else clause
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:2:21: error: expected type 'i32', found 'void'
1416// tmp.zig:6:15: error: incompatible types: 'i32' and 'void'
test/compile_errors/stage1/obj/missing_field_in_struct_value_expression.zig+3-1
......@@ -13,6 +13,8 @@ export fn f() void {
1313 _ = a;
1414}
1515
16// missing field in struct value expression
16// error
17// backend=stage1
18// target=native
1719//
1820// tmp.zig:9:17: error: missing field: 'x'
test/compile_errors/stage1/obj/missing_function_call_param.zig+3-1
......@@ -24,6 +24,8 @@ fn f(foo: *const Foo, index: usize) void {
2424
2525export fn entry() usize { return @sizeOf(@TypeOf(f)); }
2626
27// missing function call param
27// error
28// backend=stage1
29// target=native
2830//
2931// tmp.zig:20:34: error: expected 1 argument(s), found 0
test/compile_errors/stage1/obj/missing_function_name.zig+3-1
......@@ -1,6 +1,8 @@
11fn () void {}
22export fn entry() usize { return @sizeOf(@TypeOf(f)); }
33
4// missing function name
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:1: error: missing function name
test/compile_errors/stage1/obj/missing_param_name.zig+3-1
......@@ -1,6 +1,8 @@
11fn f(i32) void {}
22export fn entry() usize { return @sizeOf(@TypeOf(f)); }
33
4// missing param name
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:6: error: missing parameter name
test/compile_errors/stage1/obj/missing_parameter_name_of_generic_function.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 dump(a);
55}
66
7// missing parameter name of generic function
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:1:9: error: missing parameter name
test/compile_errors/stage1/obj/missing_result_type_for_phi_node.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 foo() catch 0;
66}
77
8// missing result type for phi node
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:17: error: integer value 0 cannot be coerced to type 'void'
test/compile_errors/stage1/obj/misspelled_type_with_pointer_only_reference.zig+3-1
......@@ -30,6 +30,8 @@ fn foo() void {
3030
3131export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
3232
33// misspelled type with pointer only reference
33// error
34// backend=stage1
35// target=native
3436//
3537// tmp.zig:5:16: error: use of undeclared identifier 'JsonList'
test/compile_errors/stage1/obj/mod_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a %= a;
44}
55
6// mod assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/mod_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a % a;
44}
55
6// mod on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/mul_overflow_in_function_evaluation.zig+3-1
......@@ -5,6 +5,8 @@ fn mul(a: u16, b: u16) u16 {
55
66export fn entry() usize { return @sizeOf(@TypeOf(y)); }
77
8// mul overflow in function evaluation
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:14: error: operation caused overflow
test/compile_errors/stage1/obj/mult_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a *= a;
44}
55
6// mult assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/mult_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a * a;
44}
55
6// mult on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/mult_wrap_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a *%= a;
44}
55
6// mult wrap assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/mult_wrap_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a *% a;
44}
55
6// mult wrap on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/multiple_function_definitions.zig+3-1
......@@ -2,7 +2,9 @@ fn a() void {}
22fn a() void {}
33export fn entry() void { a(); }
44
5// multiple function definitions
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:1: error: redeclaration of 'a'
810// tmp.zig:1:1: note: other declaration here
test/compile_errors/stage1/obj/negate_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = -a;
44}
55
6// negate on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:10: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/negate_wrap_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = -%a;
44}
55
6// negate wrap on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:11: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/negation_overflow_in_function_evaluation.zig+3-1
......@@ -5,6 +5,8 @@ fn neg(x: i8) i8 {
55
66export fn entry() usize { return @sizeOf(@TypeOf(y)); }
77
8// negation overflow in function evaluation
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:12: error: negation caused overflow
test/compile_errors/stage1/obj/nested_error_set_mismatch.zig+3-1
......@@ -10,7 +10,9 @@ fn foo() ?OtherError!i32 {
1010 return null;
1111}
1212
13// nested error set mismatch
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:5:34: error: expected type '?NextError!i32', found '?OtherError!i32'
1618// tmp.zig:5:34: note: optional type child 'OtherError!i32' cannot cast into optional type child 'NextError!i32'
test/compile_errors/stage1/obj/no_else_prong_on_switch_on_global_error_set.zig+3-1
......@@ -7,6 +7,8 @@ fn foo(a: anyerror) void {
77 }
88}
99
10// no else prong on switch on global error set
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:5:5: error: else prong required when switching on type 'anyerror'
test/compile_errors/stage1/obj/noalias_on_non_pointer_param.zig+3-1
......@@ -1,6 +1,8 @@
11fn f(noalias x: i32) void { _ = x; }
22export fn entry() void { f(1234); }
33
4// noalias on non pointer param
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:6: error: noalias on non-pointer parameter
test/compile_errors/stage1/obj/non-async_function_pointer_eventually_is_inferred_to_become_async.zig+3-1
......@@ -6,7 +6,9 @@ fn func() void {
66 suspend {}
77}
88
9// non-async function pointer eventually is inferred to become async
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:1: error: 'func' cannot be async
1214// tmp.zig:3:20: note: required to be non-async here
test/compile_errors/stage1/obj/non-const_expression_function_call_with_struct_return_value_outside_function.zig+3-1
......@@ -10,6 +10,8 @@ var global_side_effect = false;
1010
1111export fn entry() usize { return @sizeOf(@TypeOf(a)); }
1212
13// non-const expression function call with struct return value outside function
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:6:26: error: unable to evaluate constant expression
test/compile_errors/stage1/obj/non-const_expression_in_struct_literal_outside_function.zig+3-1
......@@ -6,6 +6,8 @@ extern fn get_it() i32;
66
77export fn entry() usize { return @sizeOf(@TypeOf(a)); }
88
9// non-const expression in struct literal outside function
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:4:21: error: unable to evaluate constant expression
test/compile_errors/stage1/obj/non-const_switch_number_literal.zig+3-1
......@@ -10,6 +10,8 @@ fn bar() i32 {
1010 return 2;
1111}
1212
13// non-const switch number literal
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:5:17: error: cannot store runtime value in type 'comptime_int'
test/compile_errors/stage1/obj/non-const_variables_of_things_that_require_const_variables.zig+3-1
......@@ -35,7 +35,9 @@ const Foo = struct {
3535 fn bar(self: *const Foo) void {_ = self;}
3636};
3737
38// non-const variables of things that require const variables
38// error
39// backend=stage1
40// target=native
3941//
4042// tmp.zig:2:4: error: variable of type '*const comptime_int' must be const or comptime
4143// tmp.zig:6:4: error: variable of type '@Type(.Undefined)' must be const or comptime
test/compile_errors/stage1/obj/non-enum_tag_type_passed_to_union.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 _ = x;
77}
88
9// non-enum tag type passed to union
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:1:19: error: expected enum tag type, found 'u32'
test/compile_errors/stage1/obj/non-extern_function_with_var_args.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 foo();
44}
55
6// non-extern function with var args
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:1:14: error: expected type expression, found '...'
test/compile_errors/stage1/obj/non-inline_for_loop_on_a_type_that_requires_comptime.zig+3-1
......@@ -7,6 +7,8 @@ export fn entry() void {
77 for (xx) |f| { _ = f;}
88}
99
10// non-inline for loop on a type that requires comptime
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:7:5: error: values of type 'Foo' must be comptime known, but index value is runtime known
test/compile_errors/stage1/obj/non-integer_tag_type_to_automatic_union_enum.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 _ = x;
77}
88
9// non-integer tag type to automatic union enum
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:1:24: error: expected integer tag type, found 'f32'
test/compile_errors/stage1/obj/non-pure_function_returns_type.zig+3-1
......@@ -17,6 +17,8 @@ export fn function_with_return_type_type() void {
1717 list.length = 10;
1818}
1919
20// non-pure function returns type
20// error
21// backend=stage1
22// target=native
2123//
2224// tmp.zig:3:7: error: unable to evaluate constant expression
test/compile_errors/stage1/obj/non_async_function_pointer_passed_to_asyncCall.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55}
66fn afunc() void { }
77
8// non async function pointer passed to @asyncCall
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:32: error: expected async function, found 'fn() void'
test/compile_errors/stage1/obj/non_compile_time_array_concatenation.zig+3-1
......@@ -4,6 +4,8 @@ fn f() []u8 {
44var s: [10]u8 = undefined;
55export fn entry() usize { return @sizeOf(@TypeOf(f)); }
66
7// non compile time array concatenation
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:2:12: error: unable to evaluate constant expression
test/compile_errors/stage1/obj/non_constant_expression_in_array_size.zig+3-1
......@@ -6,7 +6,9 @@ fn get() usize { return global_var; }
66
77export fn entry() usize { return @sizeOf(@TypeOf(Foo)); }
88
9// non constant expression in array size
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:25: error: cannot store runtime value in compile time variable
1214// tmp.zig:2:12: note: called from here
test/compile_errors/stage1/obj/non_error_sets_used_in_merge_error_sets_operator.zig+3-1
......@@ -7,7 +7,9 @@ export fn bar() void {
77 _ = Errors;
88}
99
10// non error sets used in merge error sets operator
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:2:20: error: expected error set type, found type 'u8'
1315// tmp.zig:2:23: note: `||` merges error sets; `or` performs boolean OR
test/compile_errors/stage1/obj/non_float_passed_to_floatToInt.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// non float passed to @floatToInt
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:32: error: expected float type, found 'i32'
test/compile_errors/stage1/obj/non_int_passed_to_intToFloat.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// non int passed to @intToFloat
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:32: error: expected int type, found 'comptime_float'
test/compile_errors/stage1/obj/non_pointer_given_to_ptrToInt.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry(x: i32) usize {
22 return @ptrToInt(x);
33}
44
5// non pointer given to @ptrToInt
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:22: error: expected pointer, found 'i32'
test/compile_errors/stage1/obj/normal_string_with_newline.zig+3-1
......@@ -1,7 +1,9 @@
11const foo = "a
22b";
33
4// normal string with newline
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:13: error: expected expression, found 'invalid bytes'
79// tmp.zig:1:15: note: invalid byte: '\n'
test/compile_errors/stage1/obj/offsetOf-bad_field_name.zig+3-1
......@@ -5,6 +5,8 @@ export fn foo() usize {
55 return @offsetOf(Foo, "a",);
66}
77
8// @offsetOf - bad field name
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:27: error: struct 'Foo' has no field 'a'
test/compile_errors/stage1/obj/offsetOf-non_struct.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() usize {
33 return @offsetOf(Foo, "a",);
44}
55
6// @offsetOf - non struct
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:22: error: expected struct type, found 'i32'
test/compile_errors/stage1/obj/only_equality_binary_operator_allowed_for_error_sets.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = z;
44}
55
6// only equality binary operator allowed for error sets
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:23: error: operator not allowed for errors
test/compile_errors/stage1/obj/opaque_type_with_field.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 _ = foo;
55}
66
7// opaque type with field
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:1:25: error: opaque types cannot have fields
test/compile_errors/stage1/obj/optional_pointer_to_void_in_extern_struct.zig+3-1
......@@ -7,6 +7,8 @@ const Bar = extern struct {
77};
88export fn entry(bar: *Bar) void {_ = bar;}
99
10// optional pointer to void in extern struct
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:2:5: error: extern structs cannot contain fields of type '?*const void'
test/compile_errors/stage1/obj/or_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a or a;
44}
55
6// or on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/orelse_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a orelse false;
44}
55
6// orelse on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:11: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/out_of_range_comptime_int_passed_to_floatToInt.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// out of range comptime_int passed to @floatToInt
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:31: error: integer value 200 cannot be coerced to type 'i8'
test/compile_errors/stage1/obj/overflow_in_enum_value_allocation.zig+3-1
......@@ -7,6 +7,8 @@ pub fn main() void {
77 _ = y;
88}
99
10// overflow in enum value allocation
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:5: error: enumeration value 256 too large for type 'u8'
test/compile_errors/stage1/obj/packed_union_given_enum_tag_type.zig+3-1
......@@ -13,6 +13,8 @@ export fn entry() void {
1313 _ = a;
1414}
1515
16// packed union given enum tag type
16// error
17// backend=stage1
18// target=native
1719//
1820// tmp.zig:6:30: error: packed union does not support enum tag type
test/compile_errors/stage1/obj/packed_union_with_automatic_layout_field.zig+3-1
......@@ -11,6 +11,8 @@ export fn entry() void {
1111 _ = a;
1212}
1313
14// packed union with automatic layout field
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:6:5: error: non-packed, non-extern struct 'Foo' not allowed in packed union; no guaranteed in-memory representation
test/compile_errors/stage1/obj/panic_called_at_compile_time.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 }
55}
66
7// @panic called at compile time
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:9: error: encountered @panic at compile-time
test/compile_errors/stage1/obj/parameter_redeclaration.zig+3-1
......@@ -2,7 +2,9 @@ fn f(a : i32, a : i32) void {
22}
33export fn entry() void { f(1, 2); }
44
5// parameter redeclaration
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:1:15: error: redeclaration of function parameter 'a'
810// tmp.zig:1:6: note: previous declaration here
test/compile_errors/stage1/obj/parameter_shadowing_global.zig+3-1
......@@ -4,7 +4,9 @@ export fn entry() void {
44 f(1234);
55}
66
7// parameter shadowing global
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:2:6: error: local shadows declaration of 'Foo'
1012// tmp.zig:1:1: note: declared here
test/compile_errors/stage1/obj/pass_const_ptr_to_mutable_ptr_fn.zig+3-1
......@@ -10,6 +10,8 @@ fn ptrEql(a: *[]const u8, b: *[]const u8) bool {
1010
1111export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1212
13// pass const ptr to mutable ptr fn
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:4:19: error: expected type '*[]const u8', found '*const []const u8'
test/compile_errors/stage1/obj/passing_a_not-aligned-enough_pointer_to_cmpxchg.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() bool {
55 return x == 5678;
66}
77
8// passing a not-aligned-enough pointer to cmpxchg
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:32: error: expected type '*i32', found '*align(1) i32'
test/compile_errors/stage1/obj/passing_an_under-aligned_function_pointer.zig+3-1
......@@ -6,6 +6,8 @@ fn testImplicitlyDecreaseFnAlign(ptr: fn () align(8) i32, answer: i32) void {
66}
77fn alignedSmall() align(4) i32 { return 1234; }
88
9// passing an under-aligned function pointer
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:2:35: error: expected type 'fn() align(8) i32', found 'fn() align(4) i32'
test/compile_errors/stage1/obj/peer_cast_then_implicit_cast_const_pointer_to_mutable_C_pointer.zig+3-1
......@@ -3,7 +3,9 @@ export fn func() void {
33 strValue = strValue orelse "";
44}
55
6// peer cast then implicit cast const pointer to mutable C pointer
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:32: error: expected type '[*c]u8', found '*const [0:0]u8'
911// tmp.zig:3:32: note: cast discards const qualifier
test/compile_errors/stage1/obj/pointer_arithmetic_on_pointer-to-array.zig+3-1
......@@ -5,6 +5,8 @@ export fn foo() void {
55 _ = z;
66}
77
8// pointer arithmetic on pointer-to-array
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:4:17: error: integer value 1 cannot be coerced to type '*[10]u8'
test/compile_errors/stage1/obj/pointer_attributes_checked_when_coercing_pointer_to_anon_literal.zig+3-1
......@@ -12,7 +12,9 @@ comptime {
1212 _ = c;
1313}
1414
15// pointer attributes checked when coercing pointer to anon literal
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:2:31: error: cannot cast pointer to array literal to slice type '[][]const u8'
1820// tmp.zig:2:31: note: cast discards const qualifier
test/compile_errors/stage1/obj/pointer_to_noreturn.zig+3-1
......@@ -1,6 +1,8 @@
11fn a() *noreturn {}
22export fn entry() void { _ = a(); }
33
4// pointer to noreturn
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:9: error: pointer to noreturn not allowed
test/compile_errors/stage1/obj/popCount-non-integer.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry(x: f32) u32 {
22 return @popCount(f32, x);
33}
44
5// @popCount - non-integer
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:22: error: expected integer type, found 'f32'
test/compile_errors/stage1/obj/prevent_bad_implicit_casting_of_anyframe_types.zig+3-1
......@@ -15,7 +15,9 @@ export fn c() void {
1515}
1616fn func() void {}
1717
18// prevent bad implicit casting of anyframe types
18// error
19// backend=stage1
20// target=native
1921//
2022// tmp.zig:3:28: error: expected type 'anyframe->i32', found 'anyframe'
2123// tmp.zig:8:28: error: expected type 'anyframe->i32', found 'i32'
test/compile_errors/stage1/obj/primitives_take_precedence_over_declarations.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 _ = a;
55}
66
7// primitives take precedence over declarations
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:19: error: integer value 300 cannot be coerced to type 'u8'
test/compile_errors/stage1/obj/ptrCast_a_0_bit_type_to_a_non-_0_bit_type.zig+3-1
......@@ -4,7 +4,9 @@ export fn entry() bool {
44 return p == null;
55}
66
7// @ptrCast a 0 bit type to a non- 0 bit type
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:15: error: '*u0' and '?*u0' do not have the same in-memory representation
1012// tmp.zig:3:31: note: '*u0' has no in-memory bits
test/compile_errors/stage1/obj/ptrCast_discards_const_qualifier.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 _ = y;
55}
66
7// @ptrCast discards const qualifier
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:15: error: cast discards const qualifier
test/compile_errors/stage1/obj/ptrToInt_0_to_non_optional_pointer.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = b;
44}
55
6// @ptrToInt 0 to non optional pointer
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:13: error: pointer type '*i32' does not allow address zero
test/compile_errors/stage1/obj/ptrToInt_on_void.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() bool {
22 return @ptrToInt(&{}) == @ptrToInt(&{});
33}
44
5// @ptrToInt on *void
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:23: error: pointer to size 0 type has no address
test/compile_errors/stage1/obj/ptrcast_to_non-pointer.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry(a: *i32) usize {
22 return @ptrCast(usize, a);
33}
44
5// ptrcast to non-pointer
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:21: error: expected pointer, found 'usize'
test/compile_errors/stage1/obj/range_operator_in_switch_used_on_error_set.zig+3-1
......@@ -12,6 +12,8 @@ fn foo(x: i32) !void {
1212 }
1313}
1414
15// range operator in switch used on error set
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:3:17: error: operator not allowed for errors
test/compile_errors/stage1/obj/reading_past_end_of_pointer_casted_array.zig+3-1
......@@ -6,6 +6,8 @@ comptime {
66 _ = deref;
77}
88
9// reading past end of pointer casted array
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:26: error: attempt to read 4 bytes from [4]u8 at index 1 which is 3 bytes
test/compile_errors/stage1/obj/recursive_inferred_error_set.zig+3-1
......@@ -5,6 +5,8 @@ fn foo() !void {
55 try foo();
66}
77
8// recursive inferred error set
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:5: error: cannot resolve inferred error set '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set': function 'foo' not fully analyzed yet
test/compile_errors/stage1/obj/redefinition_of_enums.zig+3-1
......@@ -1,7 +1,9 @@
11const A = enum {x};
22const A = enum {x};
33
4// redefinition of enums
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:2:1: error: redeclaration of 'A'
79// tmp.zig:1:1: note: other declaration here
test/compile_errors/stage1/obj/redefinition_of_global_variables.zig+3-1
......@@ -1,7 +1,9 @@
11var a : i32 = 1;
22var a : i32 = 2;
33
4// redefinition of global variables
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:2:1: error: redeclaration of 'a'
79// tmp.zig:1:1: note: other declaration here
test/compile_errors/stage1/obj/redefinition_of_struct.zig+3-1
......@@ -1,7 +1,9 @@
11const A = struct { x : i32, };
22const A = struct { y : i32, };
33
4// redefinition of struct
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:2:1: error: redeclaration of 'A'
79// tmp.zig:1:1: note: other declaration here
test/compile_errors/stage1/obj/refer_to_the_type_of_a_generic_function.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 f(i32);
55}
66
7// refer to the type of a generic function
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:4:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/referring_to_a_struct_that_is_invalid.zig+3-1
......@@ -10,6 +10,8 @@ fn assert(ok: bool) void {
1010 if (!ok) unreachable;
1111}
1212
13// referring to a struct that is invalid
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:10:14: error: reached unreachable code
test/compile_errors/stage1/obj/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig+3-1
......@@ -14,6 +14,8 @@ export fn entry() void {
1414 _ = afoo;
1515}
1616
17// regression test #2980: base type u32 is not type checked properly when assigning a value within a struct
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:12:25: error: cannot convert error union to payload type. consider using `try`, `catch`, or `if`. expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(get_uval)).Fn.return_type.?).ErrorUnion.error_set!u32'
test/compile_errors/stage1/obj/reify_type.Fn_with_is_generic_true.zig+3-1
......@@ -10,6 +10,8 @@ const Foo = @Type(.{
1010});
1111comptime { _ = Foo; }
1212
13// @Type(.Fn) with is_generic = true
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:1:20: error: Type.Fn.is_generic must be false for @Type
test/compile_errors/stage1/obj/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig+3-1
......@@ -10,6 +10,8 @@ const Foo = @Type(.{
1010});
1111comptime { _ = Foo; }
1212
13// @Type(.Fn) with is_var_args = true and non-C callconv
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:1:20: error: varargs functions must have C calling convention
test/compile_errors/stage1/obj/reify_type.Fn_with_return_type_null.zig+3-1
......@@ -10,6 +10,8 @@ const Foo = @Type(.{
1010});
1111comptime { _ = Foo; }
1212
13// @Type(.Fn) with return_type = null
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:1:20: error: Type.Fn.return_type must be non-null for @Type
test/compile_errors/stage1/obj/reify_type.Pointer_with_invalid_address_space.zig+3-1
......@@ -11,6 +11,8 @@ export fn entry() void {
1111 }});
1212}
1313
14// @Type(.Pointer) with invalid address space
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:2:16: error: address space 'gs' not available in stage 1 compiler, must be .generic
test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig+3-1
......@@ -11,6 +11,8 @@ export fn entry() void {
1111 _ = @intToEnum(Tag, 0);
1212}
1313
14// @Type for exhaustive enum with non-integer tag type
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:1:20: error: Type.Enum.tag_type must be an integer type, not 'bool'
test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig+3-1
......@@ -11,6 +11,8 @@ export fn entry() void {
1111 _ = @intToEnum(Tag, 0);
1212}
1313
14// @Type for exhaustive enum with undefined tag type
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:1:20: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/reify_type_for_exhaustive_enum_with_zero_fields.zig+3-1
......@@ -11,6 +11,8 @@ export fn entry() void {
1111 _ = @intToEnum(Tag, 0);
1212}
1313
14// @Type for exhaustive enum with zero fields
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:1:20: error: enums must have 1 or more fields
test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_enum_field.zig+3-1
......@@ -27,6 +27,8 @@ export fn entry() void {
2727 tagged = .{ .unsigned = 1 };
2828}
2929
30// @Type for tagged union with extra enum field
30// error
31// backend=stage1
32// target=native
3133//
3234// tmp.zig:14:23: error: enum field missing: 'arst'
test/compile_errors/stage1/obj/reify_type_for_tagged_union_with_extra_union_field.zig+3-1
......@@ -27,7 +27,9 @@ export fn entry() void {
2727 tagged = .{ .unsigned = 1 };
2828}
2929
30// @Type for tagged union with extra union field
30// error
31// backend=stage1
32// target=native
3133//
3234// tmp.zig:13:23: error: enum field not found: 'arst'
3335// tmp.zig:1:20: note: enum declared here
test/compile_errors/stage1/obj/reify_type_for_union_with_opaque_field.zig+3-1
......@@ -12,6 +12,8 @@ export fn entry() void {
1212 _ = Untagged{};
1313}
1414
15// @Type for union with opaque field
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:1:25: error: opaque types have unknown size and therefore cannot be directly embedded in unions
test/compile_errors/stage1/obj/reify_type_for_union_with_zero_fields.zig+3-1
......@@ -10,6 +10,8 @@ export fn entry() void {
1010 _ = Untagged{};
1111}
1212
13// @Type for union with zero fields
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:1:25: error: unions must have 1 or more fields
test/compile_errors/stage1/obj/reify_type_union_payload_is_undefined.zig+3-1
......@@ -3,6 +3,8 @@ const Foo = @Type(.{
33});
44comptime { _ = Foo; }
55
6// @Type() union payload is undefined
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:1:20: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/reify_type_with_Type.Int.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 });
77}
88
9// @Type with Type.Int
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:3:31: error: expected type 'std.builtin.Type', found 'std.builtin.Type.Int'
test/compile_errors/stage1/obj/reify_type_with_non-constant_expression.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 _ = @Type(globalTypeInfo);
55}
66
7// @Type with non-constant expression
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:4:15: error: unable to evaluate constant expression
test/compile_errors/stage1/obj/reify_type_with_undefined.zig+3-1
......@@ -12,7 +12,9 @@ comptime {
1212 });
1313}
1414
15// @Type with undefined
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:2:16: error: use of undefined value here causes undefined behavior
1820// tmp.zig:5:16: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr.zig+3-1
......@@ -11,6 +11,8 @@ pub const Container = struct {
1111 not_optional: i32,
1212};
1313
14// result location incompatibility mismatching handle_is_ptr
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:3:36: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'i32', found '?i32'
test/compile_errors/stage1/obj/result_location_incompatibility_mismatching_handle_is_ptr_generic_call.zig+3-1
......@@ -11,6 +11,8 @@ pub const Container = struct {
1111 not_optional: i32,
1212};
1313
14// result location incompatibility mismatching handle_is_ptr (generic call)
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:3:36: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'i32', found '?i32'
test/compile_errors/stage1/obj/return_from_defer_expression.zig+3-1
......@@ -14,6 +14,8 @@ pub fn maybeInt() ?i32 {
1414
1515export fn entry() usize { return @sizeOf(@TypeOf(testTrickyDefer)); }
1616
17// return from defer expression
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:4:11: error: 'try' not allowed inside defer expression
test/compile_errors/stage1/obj/returning_error_from_void_async_function.zig+3-1
......@@ -5,6 +5,8 @@ fn amain() callconv(.Async) void {
55 return error.ShouldBeCompileError;
66}
77
8// returning error from void async function
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:17: error: expected type 'void', found 'error{ShouldBeCompileError}'
test/compile_errors/stage1/obj/runtime-known_async_function_called.zig+3-1
......@@ -7,6 +7,8 @@ fn amain() void {
77}
88fn afunc() callconv(.Async) void {}
99
10// runtime-known async function called
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:6:12: error: function is not comptime-known; @asyncCall required
test/compile_errors/stage1/obj/runtime-known_function_called_with_async_keyword.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55
66fn afunc() callconv(.Async) void { }
77
8// runtime-known function called with async keyword
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:15: error: function is not comptime-known; @asyncCall required
test/compile_errors/stage1/obj/runtime_assignment_to_comptime_struct_type.zig+3-1
......@@ -8,6 +8,8 @@ export fn f() void {
88 _ = foo;
99}
1010
11// runtime assignment to comptime struct type
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:7:23: error: unable to evaluate constant expression
test/compile_errors/stage1/obj/runtime_assignment_to_comptime_union_type.zig+3-1
......@@ -8,6 +8,8 @@ export fn f() void {
88 _ = foo;
99}
1010
11// runtime assignment to comptime union type
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:7:23: error: unable to evaluate constant expression
test/compile_errors/stage1/obj/runtime_cast_to_union_which_has_non-void_fields.zig+3-1
......@@ -12,7 +12,9 @@ fn foo(l: Letter) void {
1212 _ = x;
1313}
1414
15// runtime cast to union which has non-void fields
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:11:20: error: runtime cast to union 'Value' which has non-void fields
1820// tmp.zig:3:5: note: field 'A' has type 'i32'
test/compile_errors/stage1/obj/runtime_index_into_comptime_type_slice.zig+3-1
......@@ -10,6 +10,8 @@ export fn entry() void {
1010 _ = field;
1111}
1212
13// runtime index into comptime type slice
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:9:51: error: values of type 'std.builtin.Type.StructField' must be comptime known, but index value is runtime known
test/compile_errors/stage1/obj/saturating_arithmetic_does_not_allow_floats.zig+3-1
......@@ -2,6 +2,8 @@ export fn a() void {
22 _ = @as(f32, 1.0) +| @as(f32, 1.0);
33}
44
5// saturating arithmetic does not allow floats
5// error
6// backend=stage1
7// target=native
68//
79// error: invalid operands to binary expression: 'f32' and 'f32'
test/compile_errors/stage1/obj/saturating_shl_assign_does_not_allow_negative_rhs_at_comptime.zig+3-1
......@@ -5,6 +5,8 @@ export fn a() void {
55 }
66}
77
8// saturating shl assign does not allow negative rhs at comptime
8// error
9// backend=stage1
10// target=native
911//
1012// error: shift by negative value -2
test/compile_errors/stage1/obj/saturating_shl_does_not_allow_negative_rhs_at_comptime.zig+3-1
......@@ -2,6 +2,8 @@ export fn a() void {
22 _ = @as(i32, 1) <<| @as(i32, -2);
33}
44
5// saturating shl does not allow negative rhs at comptime
5// error
6// backend=stage1
7// target=native
68//
79// error: shift by negative value -2
test/compile_errors/stage1/obj/setAlignStack_in_inline_function.zig+3-1
......@@ -5,6 +5,8 @@ fn foo() callconv(.Inline) void {
55 @setAlignStack(16);
66}
77
8// @setAlignStack in inline function
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:5: error: @setAlignStack in inline function
test/compile_errors/stage1/obj/setAlignStack_in_naked_function.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() callconv(.Naked) void {
22 @setAlignStack(16);
33}
44
5// @setAlignStack in naked function
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: @setAlignStack in naked function
test/compile_errors/stage1/obj/setAlignStack_outside_function.zig+3-1
......@@ -2,6 +2,8 @@ comptime {
22 @setAlignStack(16);
33}
44
5// @setAlignStack outside function
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: @setAlignStack outside function
test/compile_errors/stage1/obj/setAlignStack_set_twice.zig+3-1
......@@ -3,7 +3,9 @@ export fn entry() void {
33 @setAlignStack(16);
44}
55
6// @setAlignStack set twice
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: alignstack set twice
911// tmp.zig:2:5: note: first set here
test/compile_errors/stage1/obj/setAlignStack_too_big.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 @setAlignStack(511 + 1);
33}
44
5// @setAlignStack too big
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: attempt to @setAlignStack(512); maximum is 256
test/compile_errors/stage1/obj/setFloatMode_twice_for_same_scope.zig+3-1
......@@ -3,7 +3,9 @@ export fn foo() void {
33 @setFloatMode(@import("std").builtin.FloatMode.Optimized);
44}
55
6// @setFloatMode twice for same scope
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: float mode set twice for same scope
911// tmp.zig:2:5: note: first set here
test/compile_errors/stage1/obj/setRuntimeSafety_twice_for_same_scope.zig+3-1
......@@ -3,7 +3,9 @@ export fn foo() void {
33 @setRuntimeSafety(false);
44}
55
6// @setRuntimeSafety twice for same scope
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: runtime safety set twice for same scope
911// tmp.zig:2:5: note: first set here
test/compile_errors/stage1/obj/setting_a_section_on_a_local_variable.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() i32 {
33 return foo;
44}
55
6// setting a section on a local variable
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:30: error: cannot set section of local variable 'foo'
test/compile_errors/stage1/obj/shift_amount_has_to_be_an_integer_type.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// shift amount has to be an integer type
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:21: error: shift amount has to be an integer type, but found '*const u8'
test/compile_errors/stage1/obj/shift_by_negative_comptime_integer.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a;
44}
55
6// shift by negative comptime integer
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:18: error: shift by negative value -1
test/compile_errors/stage1/obj/shift_left_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a >>= 2;
44}
55
6// shift left assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/shift_left_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a << 2;
44}
55
6// shift left on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/shift_right_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a >>= 2;
44}
55
6// shift right assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/shift_right_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a >> 2;
44}
55
6// shift right on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/shifting_RHS_is_log2_of_LHS_int_bit_width.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry(x: u8, y: u8) u8 {
22 return x << y;
33}
44
5// shifting RHS is log2 of LHS int bit width
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:17: error: expected type 'u3', found 'u8'
test/compile_errors/stage1/obj/shifting_without_int_type_or_comptime_known.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry(x: u8) u8 {
22 return 0x11 << x;
33}
44
5// shifting without int type or comptime known
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be compile-time known
test/compile_errors/stage1/obj/shlExact_shifts_out_1_bits.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = x;
44}
55
6// @shlExact shifts out 1 bits
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: operation caused overflow
test/compile_errors/stage1/obj/shrExact_shifts_out_1_bits.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = x;
44}
55
6// @shrExact shifts out 1 bits
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: exact shift shifted out 1 bits
test/compile_errors/stage1/obj/signed_integer_division.zig+3-1
......@@ -2,6 +2,8 @@ export fn foo(a: i32, b: i32) i32 {
22 return a / b;
33}
44
5// signed integer division
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact
test/compile_errors/stage1/obj/signed_integer_remainder_division.zig+3-1
......@@ -2,6 +2,8 @@ export fn foo(a: i32, b: i32) i32 {
22 return a % b;
33}
44
5// signed integer remainder division
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:14: error: remainder division with 'i32' and 'i32': signed integers and floats must use @rem or @mod
test/compile_errors/stage1/obj/sizeOf_bad_type.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() usize {
22 return @sizeOf(@TypeOf(null));
33}
44
5// @sizeOf bad type
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:20: error: no size available for type '@Type(.Null)'
test/compile_errors/stage1/obj/slice_cannot_have_its_bytes_reinterpreted.zig+3-1
......@@ -4,6 +4,8 @@ export fn foo() void {
44 _ = value;
55}
66
7// slice cannot have its bytes reinterpreted
7// error
8// backend=stage1
9// target=native
810//
911// :3:52: error: slice '[]const u8' cannot have its bytes reinterpreted
test/compile_errors/stage1/obj/slice_passed_as_array_init_type.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// slice passed as array init type
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: array literal requires address-of operator (&) to coerce to slice type '[]u8'
test/compile_errors/stage1/obj/slice_passed_as_array_init_type_with_elems.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// slice passed as array init type with elems
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: array literal requires address-of operator (&) to coerce to slice type '[]u8'
test/compile_errors/stage1/obj/slice_sentinel_mismatch-1.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = y;
44}
55
6// slice sentinel mismatch - 1
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:37: error: expected type '[:1]const u8', found '*const [2:2]u8'
test/compile_errors/stage1/obj/slice_sentinel_mismatch-2.zig+3-1
......@@ -4,7 +4,9 @@ fn foo() [:0]u8 {
44}
55comptime { _ = foo; }
66
7// slice sentinel mismatch - 2
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:12: error: expected type '[:0]u8', found '[]u8'
1012// tmp.zig:3:12: note: destination pointer requires a terminating '0' sentinel
test/compile_errors/stage1/obj/slicing_of_global_undefined_pointer.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = buf[0..1];
44}
55
6// slicing of global undefined pointer
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:12: error: non-zero length slice of undefined pointer
test/compile_errors/stage1/obj/slicing_single-item_pointer.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry(ptr: *i32) void {
33 _ = slice;
44}
55
6// slicing single-item pointer
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:22: error: slice of single-item pointer
test/compile_errors/stage1/obj/specify_enum_tag_type_that_is_too_small.zig+3-1
......@@ -11,6 +11,8 @@ export fn entry() void {
1111 _ = x;
1212}
1313
14// specify enum tag type that is too small
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:6:5: error: enumeration value 4 too large for type 'u2'
test/compile_errors/stage1/obj/specify_non-integer_enum_tag_type.zig+3-1
......@@ -9,6 +9,8 @@ export fn entry() void {
99 _ = x;
1010}
1111
12// specify non-integer enum tag type
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:1:21: error: expected integer, found 'f32'
test/compile_errors/stage1/obj/src_outside_function.zig+3-1
......@@ -2,6 +2,8 @@ comptime {
22 @src();
33}
44
5// @src outside function
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: @src outside function
test/compile_errors/stage1/obj/std.fmt_error_for_unused_arguments.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 @import("std").debug.print("{d} {d} {d} {d} {d}", .{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15});
33}
44
5// std.fmt error for unused arguments
5// error
6// backend=stage1
7// target=native
68//
79// ?:?:?: error: 10 unused arguments in '{d} {d} {d} {d} {d}'
test/compile_errors/stage1/obj/store_vector_pointer_with_unknown_runtime_index.zig+3-1
......@@ -9,6 +9,8 @@ fn storev(ptr: anytype, val: i32) void {
99 ptr.* = val;
1010}
1111
12// store vector pointer with unknown runtime index
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:9:8: error: unable to determine vector element index of type '*align(16:0:4:?) i32
test/compile_errors/stage1/obj/storing_runtime_value_in_compile_time_variable_then_using_it.zig+3-1
......@@ -42,6 +42,8 @@ export fn entry() void {
4242 }
4343}
4444
45// storing runtime value in compile time variable then using it
45// error
46// backend=stage1
47// target=native
4648//
4749// tmp.zig:38:29: error: cannot store runtime value in compile time variable
test/compile_errors/stage1/obj/struct_depends_on_itself_via_optional_field.zig+3-1
......@@ -10,7 +10,9 @@ export fn entry() void {
1010 _ = obj;
1111}
1212
13// struct depends on itself via optional field
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:1:17: error: struct 'LhsExpr' depends on itself
1618// tmp.zig:5:5: note: while checking this field
test/compile_errors/stage1/obj/struct_field_missing_type.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 _ = a;
77}
88
9// struct field missing type
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:2:5: error: struct field missing type
test/compile_errors/stage1/obj/struct_init_syntax_for_array.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = foo;
44}
55
6// struct init syntax for array
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:1:13: error: initializing array with struct syntax
test/compile_errors/stage1/obj/struct_with_declarations_unavailable_for_reify_type.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 _ = @Type(@typeInfo(struct { const foo = 1; }));
33}
44
5// struct with declarations unavailable for @Type
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:15: error: Type.Struct.decls must be empty for @Type
test/compile_errors/stage1/obj/struct_with_invalid_field.zig+3-1
......@@ -23,6 +23,8 @@ export fn entry() void {
2323 _ = a;
2424}
2525
26// struct with invalid field
26// error
27// backend=stage1
28// target=native
2729//
2830// tmp.zig:14:17: error: use of undeclared identifier 'HeaderValue'
test/compile_errors/stage1/obj/sub_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a -= a;
44}
55
6// sub assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/sub_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a - a;
44}
55
6// sub on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/sub_overflow_in_function_evaluation.zig+3-1
......@@ -5,6 +5,8 @@ fn sub(a: u16, b: u16) u16 {
55
66export fn entry() usize { return @sizeOf(@TypeOf(y)); }
77
8// sub overflow in function evaluation
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:14: error: operation caused overflow
test/compile_errors/stage1/obj/sub_wrap_assign_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 a -%= a;
44}
55
6// sub wrap assign on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/sub_wrap_on_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = a -% a;
44}
55
6// sub wrap on undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/suspend_inside_suspend_block.zig+3-1
......@@ -8,7 +8,9 @@ fn foo() void {
88 }
99}
1010
11// suspend inside suspend block
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:6:9: error: cannot suspend inside suspend block
1416// tmp.zig:5:5: note: other suspend block here
test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong.zig+3-1
......@@ -16,7 +16,9 @@ fn f(n: Number) i32 {
1616
1717export fn entry() usize { return @sizeOf(@TypeOf(f)); }
1818
19// switch expression - duplicate enumeration prong
19// error
20// backend=stage1
21// target=native
2022//
2123// tmp.zig:13:15: error: duplicate switch value
2224// tmp.zig:10:15: note: other value here
test/compile_errors/stage1/obj/switch_expression-duplicate_enumeration_prong_when_else_present.zig+3-1
......@@ -17,7 +17,9 @@ fn f(n: Number) i32 {
1717
1818export fn entry() usize { return @sizeOf(@TypeOf(f)); }
1919
20// switch expression - duplicate enumeration prong when else present
20// error
21// backend=stage1
22// target=native
2123//
2224// tmp.zig:13:15: error: duplicate switch value
2325// tmp.zig:10:15: note: other value here
test/compile_errors/stage1/obj/switch_expression-duplicate_or_overlapping_integer_value.zig+3-1
......@@ -8,7 +8,9 @@ fn foo(x: u8) u8 {
88}
99export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1010
11// switch expression - duplicate or overlapping integer value
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:6:9: error: duplicate switch value
1416// tmp.zig:5:14: note: previous value here
test/compile_errors/stage1/obj/switch_expression-duplicate_type.zig+3-1
......@@ -9,7 +9,9 @@ fn foo(comptime T: type, x: T) u8 {
99}
1010export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); }
1111
12// switch expression - duplicate type
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:6:9: error: duplicate switch value
1517// tmp.zig:4:9: note: previous value here
test/compile_errors/stage1/obj/switch_expression-duplicate_type_struct_alias.zig+3-1
......@@ -13,7 +13,9 @@ fn foo(comptime T: type, x: T) u8 {
1313}
1414export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); }
1515
16// switch expression - duplicate type (struct alias)
16// error
17// backend=stage1
18// target=native
1719//
1820// tmp.zig:10:9: error: duplicate switch value
1921// tmp.zig:8:9: note: previous value here
test/compile_errors/stage1/obj/switch_expression-missing_enumeration_prong.zig+3-1
......@@ -14,6 +14,8 @@ fn f(n: Number) i32 {
1414
1515export fn entry() usize { return @sizeOf(@TypeOf(f)); }
1616
17// switch expression - missing enumeration prong
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:8:5: error: enumeration value 'Number.Four' not handled in switch
test/compile_errors/stage1/obj/switch_expression-multiple_else_prongs.zig+3-1
......@@ -9,6 +9,8 @@ export fn entry() void {
99 f(1234);
1010}
1111
12// switch expression - multiple else prongs
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:5:9: error: multiple else prongs in switch expression
test/compile_errors/stage1/obj/switch_expression-non_exhaustive_integer_prongs.zig+3-1
......@@ -5,6 +5,8 @@ fn foo(x: u8) void {
55}
66export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
77
8// switch expression - non exhaustive integer prongs
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:2:5: error: switch must handle all possibilities
test/compile_errors/stage1/obj/switch_expression-switch_on_pointer_type_with_no_else.zig+3-1
......@@ -6,6 +6,8 @@ fn foo(x: *u8) void {
66const y: u8 = 100;
77export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
88
9// switch expression - switch on pointer type with no else
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:2:5: error: else prong required when switching on type '*u8'
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_bool.zig+3-1
......@@ -7,6 +7,8 @@ fn foo(x: bool) void {
77}
88export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
99
10// switch expression - unreachable else prong (bool)
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:5:9: error: unreachable else prong, all cases already handled
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_enum.zig+3-1
......@@ -17,6 +17,8 @@ fn foo(x: u8) void {
1717
1818export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1919
20// switch expression - unreachable else prong (enum)
20// error
21// backend=stage1
22// target=native
2123//
2224// tmp.zig:14:9: error: unreachable else prong, all cases already handled
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_i8.zig+3-1
......@@ -10,6 +10,8 @@ fn foo(x: i8) void {
1010}
1111export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1212
13// switch expression - unreachable else prong (range i8)
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:8:9: error: unreachable else prong, all cases already handled
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_range_u8.zig+3-1
......@@ -10,6 +10,8 @@ fn foo(x: u8) void {
1010}
1111export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1212
13// switch expression - unreachable else prong (range u8)
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:8:9: error: unreachable else prong, all cases already handled
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u1.zig+3-1
......@@ -7,6 +7,8 @@ fn foo(x: u1) void {
77}
88export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
99
10// switch expression - unreachable else prong (u1)
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:5:9: error: unreachable else prong, all cases already handled
test/compile_errors/stage1/obj/switch_expression-unreachable_else_prong_u2.zig+3-1
......@@ -9,6 +9,8 @@ fn foo(x: u2) void {
99}
1010export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1111
12// switch expression - unreachable else prong (u2)
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:7:9: error: unreachable else prong, all cases already handled
test/compile_errors/stage1/obj/switch_on_enum_with_1_field_with_no_prongs.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 switch (f) {}
66}
77
8// switch on enum with 1 field with no prongs
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:5: error: enumeration value 'Foo.M' not handled in switch
test/compile_errors/stage1/obj/switch_on_union_with_no_attached_enum.zig+3-1
......@@ -14,7 +14,9 @@ fn foo(a: *const Payload) void {
1414 }
1515}
1616
17// switch on union with no attached enum
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:11:14: error: switch on union which has no attached enum
2022// tmp.zig:1:17: note: consider 'union(enum)' here
test/compile_errors/stage1/obj/switch_with_invalid_expression_parameter.zig+3-1
......@@ -10,6 +10,8 @@ fn Test(comptime T: type) void {
1010 _ = x;
1111}
1212
13// switch with invalid expression parameter
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:7:17: error: switch on type 'type' provides no expression parameter
test/compile_errors/stage1/obj/switch_with_overlapping_case_ranges.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 }
77}
88
9// switch with overlapping case ranges
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:9: error: duplicate switch value
test/compile_errors/stage1/obj/tagName_used_on_union_with_no_associated_enum_tag.zig+3-1
......@@ -8,7 +8,9 @@ export fn entry() void {
88 _ = tagName;
99}
1010
11// @tagName used on union with no associated enum tag
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:7:19: error: union has no associated enum
1416// tmp.zig:1:18: note: declared here
test/compile_errors/stage1/obj/take_slice_of_invalid_dereference.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// take slice of invalid dereference
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:18: error: attempt to dereference non-pointer type 'comptime_int'
test/compile_errors/stage1/obj/taking_bit_offset_of_void_field_in_struct.zig+3-1
......@@ -6,6 +6,8 @@ export fn foo() void {
66 _ = fieldOffset;
77}
88
9// taking bit offset of void field in struct
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:45: error: zero-bit field 'val' in struct 'Empty' has no offset
test/compile_errors/stage1/obj/taking_byte_offset_of_void_field_in_struct.zig+3-1
......@@ -6,6 +6,8 @@ export fn foo() void {
66 _ = fieldOffset;
77}
88
9// taking byte offset of void field in struct
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:5:42: error: zero-bit field 'val' in struct 'Empty' has no offset
test/compile_errors/stage1/obj/threadlocal_qualifier_on_const.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() i32 {
33 return x;
44}
55
6// threadlocal qualifier on const
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:1:1: error: threadlocal variable cannot be constant
test/compile_errors/stage1/obj/top_level_decl_dependency_loop.zig+3-1
......@@ -5,6 +5,8 @@ export fn entry() void {
55 _ = c;
66}
77
8// top level decl dependency loop
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:2:19: error: dependency loop detected
test/compile_errors/stage1/obj/truncate_sign_mismatch.zig+3-1
......@@ -15,7 +15,9 @@ export fn entry4() u8 {
1515 return @truncate(u8, x);
1616}
1717
18// truncate sign mismatch
18// error
19// backend=stage1
20// target=native
1921//
2022// tmp.zig:3:26: error: expected signed integer type, found 'u32'
2123// tmp.zig:7:26: error: expected unsigned integer type, found 'i32'
test/compile_errors/stage1/obj/truncate_undefined_value.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = z;
44}
55
6// @truncate undefined value
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:27: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/try_in_function_with_non_error_return_type.zig+3-1
......@@ -3,6 +3,8 @@ export fn f() void {
33}
44fn something() anyerror!void { }
55
6// try in function with non error return type
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:5: error: expected type 'void', found 'anyerror'
test/compile_errors/stage1/obj/type_checking_function_pointers.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 a(c);
77}
88
9// type checking function pointers
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:6:7: error: expected type 'fn(*const u8) void', found 'fn(u8) void'
test/compile_errors/stage1/obj/type_variables_must_be_constant.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() foo {
33 return 1;
44}
55
6// type variables must be constant
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:1:1: error: variable of type 'type' must be constant
test/compile_errors/stage1/obj/undeclared_identifier.zig+3-1
......@@ -4,6 +4,8 @@ export fn a() void {
44 c;
55}
66
7// undeclared identifier
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:5: error: use of undeclared identifier 'b'
test/compile_errors/stage1/obj/undeclared_identifier_error_should_mark_fn_as_impure.zig+3-1
......@@ -5,6 +5,8 @@ fn test_a_thing() void {
55 bad_fn_call();
66}
77
8// undeclared identifier error should mark fn as impure
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:5: error: use of undeclared identifier 'bad_fn_call'
test/compile_errors/stage1/obj/undeclared_identifier_in_unanalyzed_branch.zig+3-1
......@@ -4,6 +4,8 @@ export fn a() void {
44 }
55}
66
7// undeclared identifier in unanalyzed branch
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:9: error: use of undeclared identifier 'lol_this_doesnt_exist'
test/compile_errors/stage1/obj/undefined_as_field_type_is_rejected.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry1() void {
66 _ = foo;
77}
88
9// undefined as field type is rejected
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:2:8: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/undefined_function_call.zig+3-1
......@@ -2,6 +2,8 @@ export fn a() void {
22 b();
33}
44
5// undefined function call
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: use of undeclared identifier 'b'
test/compile_errors/stage1/obj/underscore_is_not_a_declarable_symbol.zig+3-1
......@@ -3,6 +3,8 @@ export fn f1() usize {
33 return _;
44}
55
6// `_` is not a declarable symbol
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:9: error: '_' used as an identifier without @"_" syntax
test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_for.zig+3-1
......@@ -6,6 +6,8 @@ export fn returns() void {
66 }
77}
88
9// `_` should not be usable inside for
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:4:20: error: '_' used as an identifier without @"_" syntax
test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while.zig+3-1
......@@ -9,6 +9,8 @@ fn optionalReturn() ?u32 {
99 return 1;
1010}
1111
12// `_` should not be usable inside while
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:4:20: error: '_' used as an identifier without @"_" syntax
test/compile_errors/stage1/obj/underscore_should_not_be_usable_inside_while_else.zig+3-1
......@@ -11,6 +11,8 @@ fn optionalReturnError() !?u32 {
1111 return error.optionalReturnError;
1212}
1313
14// `_` should not be usable inside while else
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:6:17: error: '_' used as an identifier without @"_" syntax
test/compile_errors/stage1/obj/union_auto-enum_value_already_taken.zig+3-1
......@@ -10,7 +10,9 @@ export fn entry() void {
1010 _ = x;
1111}
1212
13// union auto-enum value already taken
13// error
14// backend=stage1
15// target=native
1416//
1517// tmp.zig:6:9: error: enum tag value 60 already taken
1618// tmp.zig:4:9: note: other occurrence here
test/compile_errors/stage1/obj/union_enum_field_does_not_match_enum.zig+3-1
......@@ -14,7 +14,9 @@ export fn entry() void {
1414 _ = a;
1515}
1616
17// union enum field does not match enum
17// error
18// backend=stage1
19// target=native
1820//
1921// tmp.zig:10:5: error: enum field not found: 'D'
2022// tmp.zig:1:16: note: enum declared here
test/compile_errors/stage1/obj/union_fields_with_value_assignments.zig+3-1
......@@ -6,7 +6,9 @@ export fn entry() void {
66 _ = x;
77}
88
9// union fields with value assignments
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:1:24: error: explicitly valued tagged union missing integer tag type
1214// tmp.zig:2:14: note: tag value specified here
test/compile_errors/stage1/obj/union_with_0_fields.zig+3-1
......@@ -1,5 +1,7 @@
11const Foo = union {};
22
3// union with 0 fields
3// error
4// backend=stage1
5// target=native
46//
57// tmp.zig:1:13: error: union declarations must have at least one tag
test/compile_errors/stage1/obj/union_with_specified_enum_omits_field.zig+3-1
......@@ -11,7 +11,9 @@ export fn entry() usize {
1111 return @sizeOf(Payload);
1212}
1313
14// union with specified enum omits field
14// error
15// backend=stage1
16// target=native
1517//
1618// tmp.zig:6:17: error: enum field missing: 'C'
1719// tmp.zig:4:5: note: declared here
test/compile_errors/stage1/obj/union_with_too_small_explicit_signed_tag_type.zig+3-1
......@@ -8,7 +8,9 @@ export fn entry() void {
88 _ = U{ .D = 1 };
99}
1010
11// union with too small explicit signed tag type
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:1:22: error: specified integer tag type cannot represent every field
1416// tmp.zig:1:22: note: type i2 cannot fit values in range 0...3
test/compile_errors/stage1/obj/union_with_too_small_explicit_unsigned_tag_type.zig+3-1
......@@ -9,7 +9,9 @@ export fn entry() void {
99 _ = U{ .E = 1 };
1010}
1111
12// union with too small explicit unsigned tag type
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:1:22: error: specified integer tag type cannot represent every field
1517// tmp.zig:1:22: note: type u2 cannot fit values in range 0...4
test/compile_errors/stage1/obj/unknown_length_pointer_to_opaque.zig+3-1
......@@ -1,5 +1,7 @@
11export const T = [*]opaque {};
22
3// unknown length pointer to opaque
3// error
4// backend=stage1
5// target=native
46//
57// tmp.zig:1:21: error: unknown-length pointer to opaque
test/compile_errors/stage1/obj/unreachable_code-double_break.zig+3-1
......@@ -4,7 +4,9 @@ export fn a() void {
44 };
55}
66
7// unreachable code - double break
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:9: error: unreachable code
1012// tmp.zig:3:20: note: control flow is diverted here
test/compile_errors/stage1/obj/unreachable_code-nested_returns.zig+3-1
......@@ -2,7 +2,9 @@ export fn a() i32 {
22 return return 1;
33}
44
5// unreachable code - nested returns
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: unreachable code
810// tmp.zig:2:12: note: control flow is diverted here
test/compile_errors/stage1/obj/unreachable_code.zig+3-1
......@@ -5,7 +5,9 @@ export fn a() void {
55
66fn b() void {}
77
8// unreachable code
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:3:6: error: unreachable code
1113// tmp.zig:2:5: note: control flow is diverted here
test/compile_errors/stage1/obj/unreachable_executed_at_comptime.zig+3-1
......@@ -8,7 +8,9 @@ export fn entry() void {
88 _ = foo(-42);
99}
1010
11// unreachable executed at comptime
11// error
12// backend=stage1
13// target=native
1214//
1315// tmp.zig:4:9: error: reached unreachable code
1416// tmp.zig:8:12: note: called from here
test/compile_errors/stage1/obj/unreachable_parameter.zig+3-1
......@@ -1,6 +1,8 @@
11fn f(a: noreturn) void { _ = a; }
22export fn entry() void { f(); }
33
4// unreachable parameter
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:9: error: parameter of type 'noreturn' not allowed
test/compile_errors/stage1/obj/unreachable_variable.zig+3-1
......@@ -3,6 +3,8 @@ export fn f() void {
33 _ = a;
44}
55
6// unreachable variable
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:25: error: expected type 'noreturn', found 'void'
test/compile_errors/stage1/obj/unreachable_with_return.zig+3-1
......@@ -1,6 +1,8 @@
11fn a() noreturn {return;}
22export fn entry() void { a(); }
33
4// unreachable with return
4// error
5// backend=stage1
6// target=native
57//
68// tmp.zig:1:18: error: expected type 'noreturn', found 'void'
test/compile_errors/stage1/obj/unsupported_modifier_at_start_of_asm_output_constraint.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33 asm volatile ("" : [baz]"+r"(bar) : : "");
44}
55
6// unsupported modifier at start of asm output constraint
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:5: error: invalid modifier starting output constraint for 'baz': '+', only '=' is supported. Compiler TODO: see https://github.com/ziglang/zig/issues/215
test/compile_errors/stage1/obj/unused_variable_error_on_errdefer.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 foo() catch unreachable;
77}
88
9// unused variable error on errdefer
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:2:15: error: unused variable: 'a'
test/compile_errors/stage1/obj/use_anyopaque_as_return_type_of_fn_ptr.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = a;
44}
55
6// use anyopaque as return type of fn ptr
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:20: error: return type cannot be opaque
test/compile_errors/stage1/obj/use_implicit_casts_to_assign_null_to_non-nullable_pointer.zig+3-1
......@@ -7,6 +7,8 @@ export fn entry() void {
77 _ = y;
88}
99
10// use implicit casts to assign null to non-nullable pointer
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:4:23: error: expected type '*?*i32', found '**i32'
test/compile_errors/stage1/obj/use_invalid_number_literal_as_array_index.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 _ = arr;
55}
66
7// use invalid number literal as array index
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:1:1: error: unable to infer variable type
test/compile_errors/stage1/obj/use_of_comptime-known_undefined_function_value.zig+3-1
......@@ -6,6 +6,8 @@ export fn entry() void {
66 command.exec();
77}
88
9// use of comptime-known undefined function value
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:6:12: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/use_of_undeclared_identifier.zig+3-1
......@@ -2,6 +2,8 @@ export fn f() void {
22 b = 3;
33}
44
5// use of undeclared identifier
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: use of undeclared identifier 'b'
test/compile_errors/stage1/obj/using_an_unknown_len_ptr_type_instead_of_array.zig+3-1
......@@ -6,6 +6,8 @@ comptime {
66 _ = resolutions;
77}
88
9// using an unknown len ptr type instead of array
9// error
10// backend=stage1
11// target=native
1012//
1113// tmp.zig:1:21: error: expected array type or [_], found '[*][*]const u8'
test/compile_errors/stage1/obj/using_invalid_types_in_function_call_raises_an_error.zig+3-1
......@@ -4,6 +4,8 @@ export fn entry() void {
44 func(MenuEffect.ThisDoesNotExist);
55}
66
7// using invalid types in function call raises an error
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:1:20: error: enum declarations must have at least one tag
test/compile_errors/stage1/obj/usingnamespace_with_wrong_type.zig+3-1
......@@ -1,5 +1,7 @@
11usingnamespace void;
22
3// usingnamespace with wrong type
3// error
4// backend=stage1
5// target=native
46//
57// tmp.zig:1:1: error: expected struct, enum, or union; found 'void'
test/compile_errors/stage1/obj/variable_has_wrong_type.zig+3-1
......@@ -3,6 +3,8 @@ export fn f() i32 {
33 return a;
44}
55
6// variable has wrong type
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:12: error: expected type 'i32', found '*const [1:0]u8'
test/compile_errors/stage1/obj/variable_in_inline_assembly_template_cannot_be_found.zig created+12
......@@ -0,0 +1,12 @@
1export fn entry() void {
2 var sp = asm volatile ("mov %[foo], sp"
3 : [bar] "=r" (-> usize),
4 );
5 _ = sp;
6}
7
8// error
9// backend=stage1
10// target=x86_64-linux-gnu
11//
12// tmp.zig:2:14: error: could not find 'foo' in the inputs or outputs
test/compile_errors/stage1/obj/variable_initialization_compile_error_then_referenced.zig+3-1
......@@ -12,6 +12,8 @@ export fn entry() void {
1212 _ = S;
1313}
1414
15// variable initialization compile error then referenced
15// error
16// backend=stage1
17// target=native
1618//
1719// tmp.zig:2:12: error: use of undeclared identifier 'T'
test/compile_errors/stage1/obj/variable_with_type_noreturn.zig+3-1
......@@ -2,7 +2,9 @@ export fn entry9() void {
22 var z: noreturn = return;
33}
44
5// variable with type 'noreturn'
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:5: error: unreachable code
810// tmp.zig:2:23: note: control flow is diverted here
test/compile_errors/stage1/obj/vector_index_out_of_bounds.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 _ = x;
44}
55
6// vector index out of bounds
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:62: error: index 3 outside vector of size 3
test/compile_errors/stage1/obj/volatile_on_global_assembly.zig+3-1
......@@ -2,6 +2,8 @@ comptime {
22 asm volatile ("");
33}
44
5// volatile on global assembly
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:9: error: volatile is meaningless on global assembly
test/compile_errors/stage1/obj/wasmMemoryGrow_is_a_compile_error_in_non-Wasm_targets.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33 return;
44}
55
6// wasmMemoryGrow is a compile error in non-Wasm targets
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:9: error: @wasmMemoryGrow is a wasm32 feature only
test/compile_errors/stage1/obj/wasmMemorySize_is_a_compile_error_in_non-Wasm_targets.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33 return;
44}
55
6// wasmMemorySize is a compile error in non-Wasm targets
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:9: error: @wasmMemorySize is a wasm32 feature only
test/compile_errors/stage1/obj/while_expected_bool_got_error_union.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33}
44fn bar() anyerror!i32 { return 1; }
55
6// while expected bool, got error union
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: expected type 'bool', found 'anyerror!i32'
test/compile_errors/stage1/obj/while_expected_bool_got_optional.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33}
44fn bar() ?i32 { return 1; }
55
6// while expected bool, got optional
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: expected type 'bool', found '?i32'
test/compile_errors/stage1/obj/while_expected_error_union_got_bool.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33}
44fn bar() bool { return true; }
55
6// while expected error union, got bool
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: expected error union type, found 'bool'
test/compile_errors/stage1/obj/while_expected_error_union_got_optional.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33}
44fn bar() ?i32 { return 1; }
55
6// while expected error union, got optional
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: expected error union type, found '?i32'
test/compile_errors/stage1/obj/while_expected_optional_got_bool.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33}
44fn bar() bool { return true; }
55
6// while expected optional, got bool
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: expected optional type, found 'bool'
test/compile_errors/stage1/obj/while_expected_optional_got_error_union.zig+3-1
......@@ -3,6 +3,8 @@ export fn foo() void {
33}
44fn bar() anyerror!i32 { return 1; }
55
6// while expected optional, got error union
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:15: error: expected optional type, found 'anyerror!i32'
test/compile_errors/stage1/obj/while_loop_body_expression_ignored.zig+3-1
......@@ -13,7 +13,9 @@ export fn f3() void {
1313 while (x) |_| returns() else |_| unreachable;
1414}
1515
16// while loop body expression ignored
16// error
17// backend=stage1
18// target=native
1719//
1820// tmp.zig:5:25: error: expression value is ignored
1921// tmp.zig:9:26: error: expression value is ignored
test/compile_errors/stage1/obj/write_to_const_global_variable.zig+3-1
......@@ -4,6 +4,8 @@ fn f() void {
44}
55export fn entry() void { f(); }
66
7// write to const global variable
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:3:9: error: cannot assign to constant
test/compile_errors/stage1/obj/wrong_frame_type_used_for_async_call.zig+3-1
......@@ -9,6 +9,8 @@ fn bar() void {
99 suspend {}
1010}
1111
12// wrong frame type used for async call
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:3:13: error: expected type '*@Frame(bar)', found '*@Frame(foo)'
test/compile_errors/stage1/obj/wrong_function_type.zig+3-1
......@@ -4,6 +4,8 @@ fn b() i32 {return 1;}
44fn c() i32 {return 2;}
55export fn entry() usize { return @sizeOf(@TypeOf(fns)); }
66
7// wrong function type
7// error
8// backend=stage1
9// target=native
810//
911// tmp.zig:1:28: error: expected type 'fn() void', found 'fn() i32'
test/compile_errors/stage1/obj/wrong_initializer_for_union_payload_of_type_type.zig+3-1
......@@ -9,6 +9,8 @@ export fn entry() void {
99 v.u.A = U{ .A = i32 };
1010}
1111
12// wrong initializer for union payload of type 'type'
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:9:8: error: use of undefined value here causes undefined behavior
test/compile_errors/stage1/obj/wrong_number_of_arguments.zig+3-1
......@@ -3,6 +3,8 @@ export fn a() void {
33}
44fn c(d: i32, e: i32, f: i32) void { _ = d; _ = e; _ = f; }
55
6// wrong number of arguments
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:6: error: expected 3 argument(s), found 1
test/compile_errors/stage1/obj/wrong_number_of_arguments_for_method_fn_call.zig+3-1
......@@ -7,6 +7,8 @@ fn f(foo: *const Foo) void {
77}
88export fn entry() usize { return @sizeOf(@TypeOf(f)); }
99
10// wrong number of arguments for method fn call
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:6:15: error: expected 2 argument(s), found 3
test/compile_errors/stage1/obj/wrong_panic_signature_generic_function.zig+3-1
......@@ -4,7 +4,9 @@ pub fn panic(comptime msg: []const u8, error_return_trace: ?*builtin.StackTrace)
44}
55const builtin = @import("std").builtin;
66
7// wrong panic signature, generic function
7// error
8// backend=stage1
9// target=native
810//
911// error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype'
1012// note: only one of the functions is generic
test/compile_errors/stage1/obj/wrong_panic_signature_runtime_function.zig+3-1
......@@ -3,6 +3,8 @@ test "" {}
33pub fn panic() void {}
44
55
6// wrong panic signature, runtime function
6// error
7// backend=stage1
8// target=native
79//
810// error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn() void'
test/compile_errors/stage1/obj/wrong_pointer_coerced_to_pointer_to_opaque_{}.zig+3-1
......@@ -5,6 +5,8 @@ export fn foo() void {
55 bar(@ptrCast(*anyopaque, &x));
66}
77
8// wrong pointer coerced to pointer to opaque {}
8// error
9// backend=stage1
10// target=native
911//
1012// tmp.zig:5:9: error: expected type '*Derp', found '*anyopaque'
test/compile_errors/stage1/obj/wrong_return_type_for_main.zig+3-1
......@@ -1,5 +1,7 @@
11pub fn main() f32 { }
22
3// wrong return type for main
3// error
4// backend=stage1
5// target=native
46//
57// error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'
test/compile_errors/stage1/obj/wrong_size_to_an_array_literal.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 _ = array;
44}
55
6// wrong size to an array literal
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:2:31: error: index 2 outside array of size 2
test/compile_errors/stage1/obj/wrong_type_for_argument_tuple_to_asyncCall.zig+3-1
......@@ -7,6 +7,8 @@ fn foo() i32 {
77 return 0;
88}
99
10// wrong type for argument tuple to @asyncCall
10// error
11// backend=stage1
12// target=native
1113//
1214// tmp.zig:3:33: error: expected tuple or struct, found 'void'
test/compile_errors/stage1/obj/wrong_type_for_reify_type.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() void {
22 _ = @Type(0);
33}
44
5// wrong type for @Type
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:15: error: expected type 'std.builtin.Type', found 'comptime_int'
test/compile_errors/stage1/obj/wrong_type_for_result_ptr_to_asyncCall.zig+3-1
......@@ -9,6 +9,8 @@ fn foo() i32 {
99 return 1234;
1010}
1111
12// wrong type for result ptr to @asyncCall
12// error
13// backend=stage1
14// target=native
1315//
1416// tmp.zig:6:37: error: expected type '*i32', found 'bool'
test/compile_errors/stage1/obj/wrong_type_passed_to_panic.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 @panic(e);
44}
55
6// wrong type passed to @panic
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:12: error: expected type '[]const u8', found 'error{Foo}'
test/compile_errors/stage1/obj/wrong_type_to_hasField.zig+3-1
......@@ -2,6 +2,8 @@ export fn entry() bool {
22 return @hasField(i32, "hi");
33}
44
5// wrong type to @hasField
5// error
6// backend=stage1
7// target=native
68//
79// tmp.zig:2:22: error: type 'i32' does not support @hasField
test/compile_errors/stage1/obj/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig+3-1
......@@ -3,6 +3,8 @@ export fn entry() void {
33 while (!@cmpxchgWeak(i32, &x, 1234, 5678, @as(u32, 1234), @as(u32, 1234))) {}
44}
55
6// wrong types given to atomic order args in cmpxchg
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:47: error: expected type 'std.builtin.AtomicOrder', found 'u32'
test/compile_errors/stage1/obj/wrong_types_given_to_export.zig+3-1
......@@ -3,6 +3,8 @@ comptime {
33 @export(entry, .{.name = "entry", .linkage = @as(u32, 1234) });
44}
55
6// wrong types given to @export
6// error
7// backend=stage1
8// target=native
79//
810// tmp.zig:3:59: error: expected type 'std.builtin.GlobalLinkage', found 'comptime_int'
test/compile_errors/stage1/test/access_invalid_typeInfo_decl.zig+4-1
......@@ -3,6 +3,9 @@ test "Crash" {
33 _ = @typeInfo(@This()).Struct.decls[0];
44}
55
6// access invalid @typeInfo decl
6// error
7// backend=stage1
8// target=native
9// is_test=1
710//
811// tmp.zig:1:11: error: use of undeclared identifier 'B'
test/compile_errors/stage1/test/alignCast_of_zero_sized_types.zig+4-1
......@@ -17,7 +17,10 @@ export fn qux() void {
1717 _ = @alignCast(2, a);
1818}
1919
20// @alignCast of zero sized types
20// error
21// backend=stage1
22// target=native
23// is_test=1
2124//
2225// tmp.zig:3:23: error: cannot adjust alignment of zero sized type '*void'
2326// tmp.zig:7:23: error: cannot adjust alignment of zero sized type '?*void'
test/compile_errors/stage1/test/bad_splat_type.zig+4-1
......@@ -4,6 +4,9 @@ export fn entry() void {
44 _ = v;
55}
66
7// bad @splat type
7// error
8// backend=stage1
9// target=native
10// is_test=1
811//
912// tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; 'comptime_int' is invalid
test/compile_errors/stage1/test/binary_OR_operator_on_error_sets.zig+4-1
......@@ -5,6 +5,9 @@ export fn entry() void {
55 _ = x;
66}
77
8// binary OR operator on error sets
8// error
9// backend=stage1
10// target=native
11// is_test=1
912//
1013// tmp.zig:2:18: error: invalid operands to binary expression: 'error{A}' and 'error{B}'
test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-always_inline.zig+4-1
......@@ -3,6 +3,9 @@ pub export fn entry() void {
33 @call(.{ .modifier = .always_inline }, call_me, .{});
44}
55
6// @call rejects non comptime-known fn - always_inline
6// error
7// backend=stage1
8// target=native
9// is_test=1
710//
811// tmp.zig:3:5: error: the specified modifier requires a comptime-known function
test/compile_errors/stage1/test/call_rejects_non_comptime-known_fn-compile_time.zig+4-1
......@@ -3,6 +3,9 @@ pub export fn entry() void {
33 @call(.{ .modifier = .compile_time }, call_me, .{});
44}
55
6// @call rejects non comptime-known fn - compile_time
6// error
7// backend=stage1
8// target=native
9// is_test=1
710//
811// tmp.zig:3:5: error: the specified modifier requires a comptime-known function
test/compile_errors/stage1/test/cast_between_optional_T_where_T_is_not_a_pointer.zig+4-1
......@@ -6,7 +6,10 @@ export fn entry() void {
66 a = b;
77}
88
9// cast between ?T where T is not a pointer
9// error
10// backend=stage1
11// target=native
12// is_test=1
1013//
1114// tmp.zig:6:9: error: expected type '?fn(i8) void', found '?fn(u64) void'
1215// tmp.zig:6:9: note: optional type child 'fn(u64) void' cannot cast into optional type child 'fn(i8) void'
test/compile_errors/stage1/test/combination_of_nosuspend_and_async.zig+4-1
......@@ -7,7 +7,10 @@ export fn entry() void {
77}
88fn foo() void {}
99
10// combination of nosuspend and async
10// error
11// backend=stage1
12// target=native
13// is_test=1
1114//
1215// tmp.zig:4:9: error: suspend inside nosuspend block
1316// tmp.zig:2:5: note: nosuspend block here
test/compile_errors/stage1/test/comparison_of_non-tagged_union_and_enum_literal.zig+4-1
......@@ -5,7 +5,10 @@ export fn entry() void {
55 _ = ok;
66}
77
8// comparison of non-tagged union and enum literal
8// error
9// backend=stage1
10// target=native
11// is_test=1
912//
1013// tmp.zig:4:16: error: comparison of union and enum literal is only valid for tagged union types
1114// tmp.zig:2:15: note: type U is not a tagged union
test/compile_errors/stage1/test/comptime_vector_overflow_shows_the_index.zig+4-1
......@@ -5,7 +5,10 @@ comptime {
55 _ = x;
66}
77
8// comptime vector overflow shows the index
8// error
9// backend=stage1
10// target=native
11// is_test=1
912//
1013// tmp.zig:4:15: error: operation caused overflow
1114// tmp.zig:4:15: note: when computing vector element at index 2
test/compile_errors/stage1/test/duplicate_field_in_anonymous_struct_literal.zig+4-1
......@@ -10,7 +10,10 @@ export fn entry() void {
1010 _ = anon;
1111}
1212
13// duplicate field in anonymous struct literal
13// error
14// backend=stage1
15// target=native
16// is_test=1
1417//
1518// tmp.zig:7:13: error: duplicate field
1619// tmp.zig:4:13: note: other field here
test/compile_errors/stage1/test/error_in_struct_initializer_doesnt_crash_the_compiler.zig+4-1
......@@ -7,6 +7,9 @@ pub export fn entry() void {
77 _ = a;
88}
99
10// error in struct initializer doesn't crash the compiler
10// error
11// backend=stage1
12// target=native
13// is_test=1
1114//
1215// tmp.zig:4:9: error: duplicate struct field: 'e'
test/compile_errors/stage1/test/errors_in_for_loop_bodies_are_propagated.zig+4-1
......@@ -3,6 +3,9 @@ pub export fn entry() void {
33 for (arr) |bits| _ = @popCount(bits);
44}
55
6// errors in for loop bodies are propagated
6// error
7// backend=stage1
8// target=native
9// is_test=1
710//
811// tmp.zig:3:26: error: expected 2 arguments, found 1
test/compile_errors/stage1/test/export_with_empty_name_string.zig+4-1
......@@ -3,6 +3,9 @@ comptime {
33 @export(entry, .{ .name = "" });
44}
55
6// @export with empty name string
6// error
7// backend=stage1
8// target=native
9// is_test=1
710//
811// tmp.zig:3:5: error: exported symbol name cannot be empty
test/compile_errors/stage1/test/helpful_return_type_error_message.zig+4-1
......@@ -15,7 +15,10 @@ export fn quux() u32 {
1515 buf = bar();
1616}
1717
18// helpful return type error message
18// error
19// backend=stage1
20// target=native
21// is_test=1
1922//
2023// tmp.zig:2:17: error: expected type 'u32', found 'error{Ohno}'
2124// tmp.zig:1:17: note: function cannot return an error
test/compile_errors/stage1/test/int-float_conversion_to_comptime_int-float.zig+4-1
......@@ -7,7 +7,10 @@ export fn bar() void {
77 _ = @intToFloat(comptime_float, a);
88}
99
10// int/float conversion to comptime_int/float
10// error
11// backend=stage1
12// target=native
13// is_test=1
1114//
1215// tmp.zig:3:35: error: unable to evaluate constant expression
1316// tmp.zig:7:37: error: unable to evaluate constant expression
test/compile_errors/stage1/test/invalid_assignments.zig+4-1
......@@ -10,7 +10,10 @@ export fn entry4() void {
1010 2 + 2 = 3;
1111}
1212
13// invalid assignments
13// error
14// backend=stage1
15// target=native
16// is_test=1
1417//
1518// tmp.zig:3:6: error: invalid left-hand side to assignment
1619// tmp.zig:7:7: error: invalid left-hand side to assignment
test/compile_errors/stage1/test/invalid_float_casts.zig+4-1
......@@ -15,7 +15,10 @@ export fn qux() void {
1515 _ = @floatCast(f32, a);
1616}
1717
18// invalid float casts
18// error
19// backend=stage1
20// target=native
21// is_test=1
1922//
2023// tmp.zig:3:36: error: unable to evaluate constant expression
2124// tmp.zig:7:21: error: expected integer type, found 'f32'
test/compile_errors/stage1/test/invalid_int_casts.zig+4-1
......@@ -15,7 +15,10 @@ export fn qux() void {
1515 _ = @intCast(u32, a);
1616}
1717
18// invalid int casts
18// error
19// backend=stage1
20// target=native
21// is_test=1
1922//
2023// tmp.zig:3:32: error: unable to evaluate constant expression
2124// tmp.zig:7:21: error: expected float type, found 'u32'
test/compile_errors/stage1/test/invalid_non-exhaustive_enum_to_union.zig+4-1
......@@ -18,7 +18,10 @@ export fn bar() void {
1818 _ = u;
1919}
2020
21// invalid non-exhaustive enum to union
21// error
22// backend=stage1
23// target=native
24// is_test=1
2225//
2326// tmp.zig:12:16: error: runtime cast to union 'U' from non-exhaustive enum
2427// tmp.zig:17:16: error: no tag by value 15
test/compile_errors/stage1/test/invalid_pointer_with_reify_type.zig+4-1
......@@ -11,6 +11,9 @@ export fn entry() void {
1111 }});
1212}
1313
14// invalid pointer with @Type
14// error
15// backend=stage1
16// target=native
17// is_test=1
1518//
1619// tmp.zig:2:16: error: sentinels are only allowed on slices and unknown-length pointers
test/compile_errors/stage1/test/nested_vectors.zig+4-1
......@@ -5,6 +5,9 @@ export fn entry() void {
55 _ = v;
66}
77
8// nested vectors
8// error
9// backend=stage1
10// target=native
11// is_test=1
912//
1013// tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid
test/compile_errors/stage1/test/non-exhaustive_enum_marker_assigned_a_value.zig+4-1
......@@ -10,7 +10,10 @@ const B = enum {
1010};
1111comptime { _ = A; _ = B; }
1212
13// non-exhaustive enum marker assigned a value
13// error
14// backend=stage1
15// target=native
16// is_test=1
1417//
1518// tmp.zig:4:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value
1619// tmp.zig:6:11: error: non-exhaustive enum missing integer tag type
test/compile_errors/stage1/test/non-exhaustive_enums.zig+4-1
......@@ -13,7 +13,10 @@ pub export fn entry() void {
1313 _ = C;
1414}
1515
16// non-exhaustive enums
16// error
17// backend=stage1
18// target=native
19// is_test=1
1720//
1821// tmp.zig:3:5: error: '_' field of non-exhaustive enum must be last
1922// tmp.zig:6:11: error: non-exhaustive enum specifies every value
test/compile_errors/stage1/test/not_an_enum_type.zig+4-1
......@@ -12,6 +12,9 @@ const Error = union(enum) {
1212const InvalidToken = struct {};
1313const ExpectedVarDeclOrFn = struct {};
1414
15// not an enum type
15// error
16// backend=stage1
17// target=native
18// is_test=1
1619//
1720// tmp.zig:4:9: error: expected type '@typeInfo(Error).Union.tag_type.?', found 'type'
test/compile_errors/stage1/test/packed_struct_with_fields_of_not_allowed_types.zig+4-1
......@@ -59,7 +59,10 @@ const Enum = enum {
5959 B,
6060};
6161
62// packed struct with fields of not allowed types
62// error
63// backend=stage1
64// target=native
65// is_test=1
6366//
6467// tmp.zig:2:5: error: type 'anyerror' not allowed in packed struct; no guaranteed in-memory representation
6568// tmp.zig:5:5: error: array of 'u24' not allowed in packed struct due to padding bits (must be padded from 48 to 64 bits)
test/compile_errors/stage1/test/ptrToInt_with_pointer_to_zero-sized_type.zig+4-1
......@@ -4,6 +4,9 @@ export fn entry() void {
44 _ = x;
55}
66
7// @ptrToInt with pointer to zero-sized type
7// error
8// backend=stage1
9// target=native
10// is_test=1
811//
912// tmp.zig:3:23: error: pointer to size 0 type has no address
test/compile_errors/stage1/test/reassign_to_array_parameter.zig+4-1
......@@ -5,6 +5,9 @@ export fn entry() void {
55 reassign(.{1, 2, 3});
66}
77
8// reassign to array parameter
8// error
9// backend=stage1
10// target=native
11// is_test=1
912//
1013// tmp.zig:2:15: error: cannot assign to constant
test/compile_errors/stage1/test/reassign_to_slice_parameter.zig+4-1
......@@ -5,6 +5,9 @@ export fn entry() void {
55 reassign("foo");
66}
77
8// reassign to slice parameter
8// error
9// backend=stage1
10// target=native
11// is_test=1
912//
1013// tmp.zig:2:10: error: cannot assign to constant
test/compile_errors/stage1/test/reassign_to_struct_parameter.zig+4-1
......@@ -8,6 +8,9 @@ export fn entry() void {
88 reassign(S{.x = 3});
99}
1010
11// reassign to struct parameter
11// error
12// backend=stage1
13// target=native
14// is_test=1
1215//
1316// tmp.zig:5:10: error: cannot assign to constant
test/compile_errors/stage1/test/reference_to_const_data.zig+4-1
......@@ -19,7 +19,10 @@ export fn qux() void {
1919 ptr.x = 2;
2020}
2121
22// reference to const data
22// error
23// backend=stage1
24// target=native
25// is_test=1
2326//
2427// tmp.zig:3:14: error: cannot assign to constant
2528// tmp.zig:7:13: error: cannot assign to constant
test/compile_errors/stage1/test/reify_typeOf_with_incompatible_arguments.zig+4-1
......@@ -4,6 +4,9 @@ export fn entry() void {
44 _ = @TypeOf(var_1, var_2);
55}
66
7// @TypeOf with incompatible arguments
7// error
8// backend=stage1
9// target=native
10// is_test=1
811//
912// tmp.zig:4:9: error: incompatible types: 'f32' and 'u32'
test/compile_errors/stage1/test/reify_typeOf_with_no_arguments.zig+4-1
......@@ -2,6 +2,9 @@ export fn entry() void {
22 _ = @TypeOf();
33}
44
5// @TypeOf with no arguments
5// error
6// backend=stage1
7// target=native
8// is_test=1
69//
710// tmp.zig:2:9: error: expected at least 1 argument, found 0
test/compile_errors/stage1/test/reject_extern_function_definitions_with_body.zig+4-1
......@@ -2,6 +2,9 @@ extern "c" fn definitelyNotInLibC(a: i32, b: i32) i32 {
22 return a + b;
33}
44
5// reject extern function definitions with body
5// error
6// backend=stage1
7// target=native
8// is_test=1
69//
710// tmp.zig:1:1: error: extern functions have no body
test/compile_errors/stage1/test/reject_extern_variables_with_initializers.zig+4-1
......@@ -1,5 +1,8 @@
11extern var foo: int = 2;
22
3// reject extern variables with initializers
3// error
4// backend=stage1
5// target=native
6// is_test=1
47//
58// tmp.zig:1:23: error: extern variables have no initializers
test/compile_errors/stage1/test/repeated_invalid_field_access_to_generic_function_returning_type_crashes_compiler_2655.zig+4-1
......@@ -6,6 +6,9 @@ test "1" {
66 _ = A().a;
77}
88
9// repeated invalid field access to generic function returning type crashes compiler. #2655
9// error
10// backend=stage1
11// target=native
12// is_test=1
1013//
1114// tmp.zig:2:12: error: use of undeclared identifier 'Q'
test/compile_errors/stage1/test/return_invalid_type_from_test.zig+4-1
......@@ -1,5 +1,8 @@
11test "example" { return 1; }
22
3// return invalid type from test
3// error
4// backend=stage1
5// target=native
6// is_test=1
47//
58// tmp.zig:1:25: error: expected type 'void', found 'comptime_int'
test/compile_errors/stage1/test/shift_on_type_with_non-power-of-two_size.zig+4-1
......@@ -23,7 +23,10 @@ export fn entry() void {
2323 S.d();
2424}
2525
26// shift on type with non-power-of-two size
26// error
27// backend=stage1
28// target=native
29// is_test=1
2730//
2831// tmp.zig:5:19: error: RHS of shift is too large for LHS type
2932// tmp.zig:9:19: error: RHS of shift is too large for LHS type
test/compile_errors/stage1/test/shuffle_with_selected_index_past_first_vector_length.zig+4-1
......@@ -5,7 +5,10 @@ export fn entry() void {
55 _ = z;
66}
77
8// @shuffle with selected index past first vector length
8// error
9// backend=stage1
10// target=native
11// is_test=1
912//
1013// tmp.zig:4:39: error: mask index '4' has out-of-bounds selection
1114// tmp.zig:4:27: note: selected index '7' out of bounds of @Vector(4, u32)
test/compile_errors/stage1/test/switch_ranges_endpoints_are_validated.zig+4-1
......@@ -7,7 +7,10 @@ pub export fn entry() void {
77 }
88}
99
10// switch ranges endpoints are validated
10// error
11// backend=stage1
12// target=native
13// is_test=1
1114//
1215// tmp.zig:4:9: error: range start value is greater than the end value
1316// tmp.zig:5:9: error: range start value is greater than the end value
test/compile_errors/stage1/test/switching_with_exhaustive_enum_has___prong_.zig+4-1
......@@ -11,6 +11,9 @@ pub export fn entry() void {
1111 }
1212}
1313
14// switching with exhaustive enum has '_' prong
14// error
15// backend=stage1
16// target=native
17// is_test=1
1518//
1619// tmp.zig:7:5: error: switch on exhaustive enum has `_` prong
test/compile_errors/stage1/test/switching_with_non-exhaustive_enums.zig+4-1
......@@ -25,7 +25,10 @@ pub export fn entry() void {
2525 }
2626}
2727
28// switching with non-exhaustive enums
28// error
29// backend=stage1
30// target=native
31// is_test=1
2932//
3033// tmp.zig:12:5: error: enumeration value 'E.b' not handled in switch
3134// tmp.zig:16:5: error: switch on non-exhaustive enum must include `else` or `_` prong
test/compile_errors/stage1/test/tagName_on_invalid_value_of_non-exhaustive_enum.zig+4-1
......@@ -3,6 +3,9 @@ test "enum" {
33 _ = @tagName(@intToEnum(E, 5));
44}
55
6// @tagName on invalid value of non-exhaustive enum
6// error
7// backend=stage1
8// target=native
9// is_test=1
710//
811// tmp.zig:3:18: error: no tag by value 5
test/compile_errors/stage1/test/type_mismatch_in_C_prototype_with_varargs.zig+4-1
......@@ -6,6 +6,9 @@ export fn main() void {
66 _ = x;
77}
88
9// type mismatch in C prototype with varargs
9// error
10// backend=stage1
11// target=native
12// is_test=1
1013//
1114// tmp.zig:5:22: error: expected type 'fn([*c]u8, ...) callconv(.C) void', found 'fn([*:0]u8, ...) callconv(.C) void'
test/compile_errors/stage1/test/type_mismatch_with_tuple_concatenation.zig+4-1
......@@ -3,6 +3,9 @@ export fn entry() void {
33 x = x ++ .{ 1, 2, 3 };
44}
55
6// type mismatch with tuple concatenation
6// error
7// backend=stage1
8// target=native
9// is_test=1
710//
811// tmp.zig:3:11: error: expected type 'struct:2:14', found 'struct:3:11'
test/compile_errors/stage2/constant_inside_comptime_function_has_compile_error.zig+1
......@@ -15,6 +15,7 @@ export fn entry() void {
1515}
1616
1717// error
18// target=native
1819//
1920// :4:5: error: unreachable code
2021// :4:25: note: control flow is diverted here
test/compile_errors/stage2/duplicate-unused_labels.zig+1
......@@ -18,6 +18,7 @@ comptime {
1818}
1919
2020// error
21// target=native
2122//
2223// :2:12: error: redefinition of label 'blk'
2324// :2:5: note: previous definition here
test/compile_errors/stage2/embed_outside_package.zig+1
......@@ -3,5 +3,6 @@ export fn a() usize {
33}
44
55// error
6// target=native
67//
78//:2:23: error: embed of file outside package path: '/root/foo'
test/compile_errors/stage2/import_outside_package.zig+1
......@@ -3,5 +3,6 @@ export fn a() usize {
33}
44
55// error
6// target=native
67//
78// :2:20: error: import of file outside package path: '../../above.zig'
test/compile_errors/stage2/out_of_bounds_index.zig+1
......@@ -21,6 +21,7 @@ comptime {
2121}
2222
2323// error
24// target=native
2425//
2526// :4:26: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)
2627// :9:22: error: end index 6 out of bounds for array of length 4 +1 (sentinel)
test/compile_errors/stage2/slice_of_null_pointer.zig+1
......@@ -6,5 +6,6 @@ comptime {
66}
77
88// error
9// target=native
910//
1011// :4:14: error: slice of null pointer
test/compile_errors/stage2/struct_duplicate_field_name.zig+1
......@@ -9,6 +9,7 @@ export fn entry() void {
99}
1010
1111// error
12// target=native
1213//
1314// :3:5: error: duplicate struct field: 'foo'
1415// :2:5: note: other field here
test/compile_errors/stage2/union_access_of_inactive_field.zig+1
......@@ -9,6 +9,7 @@ comptime {
99}
1010
1111// error
12// target=native
1213//
1314// :7:16: error: access of union field 'b' while field 'a' is active
1415// :1:11: note: union declared here
test/compile_errors/stage2/union_duplicate_enum_field.zig+1
......@@ -10,6 +10,7 @@ export fn foo() void {
1010}
1111
1212// error
13// target=native
1314//
1415// :4:5: error: duplicate union field: 'a'
1516// :3:5: note: other field here
test/compile_errors/stage2/union_duplicate_field_definition.zig+1
......@@ -9,6 +9,7 @@ export fn entry() void {
99}
1010
1111// error
12// target=native
1213//
1314// :3:5: error: duplicate union field: 'foo'
1415// :2:5: note: other field here
test/compile_errors/stage2/union_enum_field_missing.zig+1
......@@ -14,6 +14,7 @@ export fn entry() usize {
1414}
1515
1616// error
17// target=native
1718//
1819// :7:1: error: enum field(s) missing in union
1920// :4:5: note: field 'c' missing, declared here
test/compile_errors/stage2/union_extra_field.zig+1
......@@ -14,6 +14,7 @@ export fn entry() usize {
1414}
1515
1616// error
17// target=native
1718//
1819// :6:1: error: enum 'tmp.E' has no field named 'd'
1920// :1:11: note: enum declared here
test/compile_errors/stage2/union_runtime_coercion_from_enum.zig+1
......@@ -15,6 +15,7 @@ export fn doTheTest() u64 {
1515}
1616
1717// error
18// target=native
1819//
1920// :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields
2021// :6:5: note: field 'a' has type 'u32'