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 {...@@ -34,15 +34,12 @@ test {
34 var ctx = TestContext.init(std.testing.allocator, arena);34 var ctx = TestContext.init(std.testing.allocator, arena);
35 defer ctx.deinit();35 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
44 {37 {
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 });
46 defer dir.close();43 defer dir.close();
4744
48 // TODO make this incremental once the bug is solved that it triggers45 // TODO make this incremental once the bug is solved that it triggers
...@@ -50,28 +47,6 @@ test {...@@ -50,28 +47,6 @@ test {
50 ctx.addTestCasesFromDir(dir, .independent);47 ctx.addTestCasesFromDir(dir, .independent);
51 }48 }
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
75 {50 {
76 const dir_path = try std.fs.path.join(arena, &.{51 const dir_path = try std.fs.path.join(arena, &.{
77 std.fs.path.dirname(@src().file).?, "..", "test", "incremental",52 std.fs.path.dirname(@src().file).?, "..", "test", "incremental",
test/cases.zig-5
...@@ -1,11 +1,6 @@...@@ -1,11 +1,6 @@
1const std = @import("std");1const std = @import("std");
2const TestContext = @import("../src/test.zig").TestContext;2const 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
9pub fn addCases(ctx: *TestContext) !void {4pub fn addCases(ctx: *TestContext) !void {
10 try @import("compile_errors.zig").addCases(ctx);5 try @import("compile_errors.zig").addCases(ctx);
11 try @import("stage2/cbe.zig").addCases(ctx);6 try @import("stage2/cbe.zig").addCases(ctx);
test/compile_errors.zig-218
...@@ -3,207 +3,6 @@ const builtin = @import("builtin");...@@ -3,207 +3,6 @@ const builtin = @import("builtin");
3const TestContext = @import("../src/test.zig").TestContext;3const TestContext = @import("../src/test.zig").TestContext;
44
5pub fn addCases(ctx: *TestContext) !void {5pub 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
207 {6 {
208 const case = ctx.obj("wrong same named struct", .{});7 const case = ctx.obj("wrong same named struct", .{});
209 case.backend = .stage1;8 case.backend = .stage1;
...@@ -366,21 +165,4 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -366,21 +165,4 @@ pub fn addCases(ctx: *TestContext) !void {
366 //, &[_][]const u8{165 //, &[_][]const u8{
367 // "tmp.zig:4:1: error: unable to inline function",166 // "tmp.zig:4:1: error: unable to inline function",
368 //});167 //});
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 }
386}168}
test/compile_errors/stage1/exe/main_missing_name.zig+4-1
...@@ -1,5 +1,8 @@...@@ -1,5 +1,8 @@
1pub fn (main) void {}1pub fn (main) void {}
22
3// main missing name3// error
4// backend=stage1
5// target=native
6// output_mode=Exe
4//7//
5// tmp.zig:1:5: error: missing function name8// 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 @@...@@ -1,5 +1,8 @@
11
22
3// missing main fn in executable3// error
4// backend=stage1
5// target=native
6// output_mode=Exe
4//7//
5// error: root source file has no member called 'main'8// error: root source file has no member called 'main'
test/compile_errors/stage1/exe/private_main_fn.zig+4-1
...@@ -1,6 +1,9 @@...@@ -1,6 +1,9 @@
1fn main() void {}1fn main() void {}
22
3// private main fn3// error
4// backend=stage1
5// target=native
6// output_mode=Exe
4//7//
5// error: 'main' is private8// error: 'main' is private
6// tmp.zig:1:1: note: declared here9// 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 {...@@ -5,6 +5,8 @@ export fn a() void {
5 _ = t;5 _ = t;
6}6}
77
8// C pointer pointing to non C ABI compatible type or has align attr8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:19: error: C pointers cannot point to non-C-ABI-compatible type 'Foo'12// 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 {...@@ -4,6 +4,8 @@ export fn a() void {
4 _ = y;4 _ = y;
5}5}
66
7// C pointer to anyopaque7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:16: error: C pointers cannot point to opaque types11// 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 {...@@ -7,6 +7,8 @@ fn func(comptime T: type) void {
7 _ = x;7 _ = x;
8}8}
99
10// @Frame() of generic function10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:2:16: error: @Frame() of generic function14// 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) {...@@ -8,7 +8,9 @@ export fn f2(x: V(4, u32)) V(4, u32) {
8 return -y;8 return -y;
9}9}
1010
11// Issue #5586: Make unary minus for unsigned types a compile error11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:3:12: error: negation of type 'u32'15// tmp.zig:3:12: error: negation of type 'u32'
14// tmp.zig:8:12: error: negation of type 'u32'16// 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 {...@@ -3,6 +3,8 @@ fn foo() void {
3 _ = sequence;3 _ = sequence;
4}4}
55
6// Issue #6823: don't allow .* to be followed by **6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:28: error: '.*' cannot be followed by '*'. Are you missing a space?10// 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 {...@@ -9,6 +9,8 @@ pub fn main() !void {
9 }9 }
10}10}
1111
12// Issue #9165: windows tcp server compilation error12// error
13// backend=stage1
14// target=native
13//15//
14// error: Unsupported OS16// error: Unsupported OS
test/compile_errors/stage1/obj/access_non-existent_member_of_error_set.zig+3-1
...@@ -4,6 +4,8 @@ comptime {...@@ -4,6 +4,8 @@ comptime {
4 _ = z;4 _ = z;
5}5}
66
7// access non-existent member of error set7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:18: error: no error named 'Bar' in 'Foo'11// 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 {...@@ -12,7 +12,9 @@ export fn entry() void {
12 _ = x;12 _ = x;
13}13}
1414
15// accessing runtime parameter from outer function15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:4:24: error: 'y' not accessible from inner function19// tmp.zig:4:24: error: 'y' not accessible from inner function
18// tmp.zig:3:28: note: crossed function definition here20// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a += a;3 a += a;
4}4}
55
6// add assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a + a;3 _ = a + a;
4}4}
55
6// add on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -5,6 +5,8 @@ fn add(a: u16, b: u16) u16 {
55
6export fn entry() usize { return @sizeOf(@TypeOf(y)); }6export fn entry() usize { return @sizeOf(@TypeOf(y)); }
77
8// add overflow in function evaluation8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:14: error: operation caused overflow12// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a +%= a;3 a +%= a;
4}4}
55
6// add wrap assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a +% a;3 _ = a +% a;
4}4}
55
6// add wrap on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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};...@@ -5,6 +5,8 @@ const x = Foo {.field = 1} + Foo {.field = 2};
55
6export fn entry() usize { return @sizeOf(@TypeOf(x)); }6export fn entry() usize { return @sizeOf(@TypeOf(x)); }
77
8// addition with non numbers8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:28: error: invalid operands to binary expression: 'Foo' and 'Foo'12// 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;...@@ -3,6 +3,8 @@ const y = &x;
3fn foo() *const i32 { return y; }3fn foo() *const i32 { return y; }
4export fn entry() usize { return @sizeOf(@TypeOf(foo)); }4export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
55
6// address of number literal6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:30: error: expected type '*const i32', found '*const comptime_int'10// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 @alignCast(4, @as(u32, 3));2 @alignCast(4, @as(u32, 3));
3}3}
44
5// @alignCast expects pointer or slice5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:19: error: expected pointer or slice, found 'u32'9// 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 {...@@ -3,6 +3,8 @@ export fn f() void {
3 _ = s;3 _ = s;
4}4}
55
6// aligned variable of zero-bit type6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned10// 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 {...@@ -7,6 +7,8 @@ export fn entry1() void {
7 _ = x;7 _ = x;
8}8}
99
10// alignment of enum field specified10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:7: error: expected ',' after field14// 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 {...@@ -12,7 +12,9 @@ export fn entry() void {
12 bar();12 bar();
13}13}
1414
15// ambiguous decl reference15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:5:13: error: ambiguous reference19// tmp.zig:5:13: error: ambiguous reference
18// tmp.zig:7:9: note: declared here20// tmp.zig:7:9: note: declared here
test/compile_errors/stage1/obj/and_on_undefined_value.zig+3-1
...@@ -3,6 +3,8 @@ comptime {...@@ -3,6 +3,8 @@ comptime {
3 _ = a and a;3 _ = a and a;
4}4}
55
6// and on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -7,7 +7,9 @@ export fn g() void {
7 _ = bad[0];7 _ = bad[0];
8}8}
99
10// array access of non array10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:8: error: array access of non-array type 'bool'14// tmp.zig:3:8: error: array access of non-array type 'bool'
13// tmp.zig:7:12: error: array access of non-array type 'bool'15// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3 _ = b;3 _ = b;
4}4}
55
6// array access of type6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:14: error: array access of non-array type 'type'10// 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 {...@@ -2,6 +2,8 @@ export fn f() void {
2 i[i] = i[i];2 i[i] = i[i];
3}3}
44
5// array access of undeclared identifier5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: use of undeclared identifier 'i'9// 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 {...@@ -9,7 +9,9 @@ export fn g() void {
9 _ = array[bad];9 _ = array[bad];
10}10}
1111
12// array access with non integer index12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:4:11: error: expected type 'usize', found 'bool'16// tmp.zig:4:11: error: expected type 'usize', found 'bool'
15// tmp.zig:9:15: error: expected type 'usize', found 'bool'17// 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";...@@ -4,6 +4,8 @@ const a = derp ++ "foo";
44
5export fn entry() usize { return @sizeOf(@TypeOf(a)); }5export fn entry() usize { return @sizeOf(@TypeOf(a)); }
66
7// array concatenation with wrong type7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:11: error: expected array, found 'usize'11// 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 {...@@ -6,7 +6,9 @@ export fn zig_return_array() [10]u8 {
6 return "1234567890".*;6 return "1234567890".*;
7}7}
88
9// array in c exported function9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:1:24: error: parameter of type '[10]u8' not allowed in function with calling convention 'C'13// tmp.zig:1:24: error: parameter of type '[10]u8' not allowed in function with calling convention 'C'
12// tmp.zig:5:30: error: return type '[10]u8' not allowed in function with calling convention 'C'14// 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 {...@@ -10,6 +10,8 @@ fn doSomeAsm() void {
10 );10 );
11}11}
1212
13// asm at compile time13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:6:5: error: unable to evaluate constant expression17// 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 {...@@ -4,7 +4,9 @@ export fn entry() void {
4}4}
5fn b() callconv(.Inline) void { }5fn b() callconv(.Inline) void { }
66
7// assign inline fn to non-comptime var7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var11// tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var
10// tmp.zig:5:1: note: declared here12// 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;...@@ -2,6 +2,8 @@ const a: *u8 = null;
22
3export fn entry() usize { return @sizeOf(@TypeOf(a)); }3export fn entry() usize { return @sizeOf(@TypeOf(a)); }
44
5// assign null to non-optional pointer5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:1:16: error: expected type '*u8', found '@Type(.Null)'9// 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 {...@@ -3,6 +3,8 @@ export fn f() void {
3 cstr[0] = 'W';3 cstr[0] = 'W';
4}4}
55
6// assign through constant pointer6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:13: error: cannot assign to constant10// 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 {...@@ -3,6 +3,8 @@ export fn f() void {
3 cstr[0] = 'W';3 cstr[0] = 'W';
4}4}
55
6// assign through constant slice6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:13: error: cannot assign to constant10// 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 {...@@ -6,6 +6,8 @@ export fn derp() void {
6 f.field = 0;6 f.field = 0;
7}7}
88
9// assign to constant field9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:6:15: error: cannot assign to constant13// 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 {...@@ -3,6 +3,8 @@ export fn f() void {
3 a = 4;3 a = 4;
4}4}
55
6// assign to constant variable6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: cannot assign to constant10// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 'a'.* = 1;2 'a'.* = 1;
3}3}
44
5// assign to invalid dereference5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:8: error: attempt to dereference non-pointer type 'comptime_int'9// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3 _ = vga_mem;3 _ = vga_mem;
4}4}
55
6// assign too big number to u166// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:24: error: integer value 753664 cannot be coerced to type 'u16'10// 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 {...@@ -2,7 +2,9 @@ export fn f() void {
2 const a = return;2 const a = return;
3}3}
44
5// assign unreachable5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: unreachable code9// tmp.zig:2:5: error: unreachable code
8// tmp.zig:2:15: note: control flow is diverted here10// 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 {...@@ -14,6 +14,8 @@ export fn entry() void {
14 _ = s;14 _ = s;
15}15}
1616
17// assigning to struct or union fields that are not optionals with a function that returns an optional17// error
18// backend=stage1
19// target=native
18//20//
19// tmp.zig:11:27: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'u8', found '?u8'21// 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 {...@@ -6,6 +6,8 @@ fn amain() callconv(.Async) void {
6 _ = x;6 _ = x;
7}7}
88
9// async function depends on its own frame9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:4:1: error: cannot resolve '@Frame(amain)': function not fully analyzed yet13// 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 {...@@ -9,7 +9,9 @@ fn other() void {
9 _ = x;9 _ = x;
10}10}
1111
12// async function indirectly depends on its own frame12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:4:1: error: unable to determine async function frame of 'amain'16// tmp.zig:4:1: error: unable to determine async function frame of 'amain'
15// tmp.zig:5:10: note: analysis of function 'other' depends on the frame17// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 @atomicStore(u32, &x, 1, .Acquire);3 @atomicStore(u32, &x, 1, .Acquire);
4}4}
55
6// atomic orderings of atomicStore Acquire or AcqRel6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:30: error: @atomicStore atomic ordering must not be Acquire or AcqRel10// 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 {...@@ -4,6 +4,8 @@ export fn f() void {
4 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {}4 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {}
5}5}
66
7// atomic orderings of cmpxchg - failure stricter than success7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:4:81: error: failure atomic ordering must be no stricter than success11// 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 {...@@ -4,6 +4,8 @@ export fn f() void {
4 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {}4 while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {}
5}5}
66
7// atomic orderings of cmpxchg - success Monotonic or stricter7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:4:58: error: success atomic ordering must be Monotonic or stricter11// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 @fence(.Monotonic);2 @fence(.Monotonic);
3}3}
44
5// atomic orderings of fence Acquire or stricter5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:12: error: atomic ordering must be Acquire or stricter9// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = @atomicRmw(bool, &x, .Add, true, .SeqCst);3 _ = @atomicRmw(bool, &x, .Add, true, .SeqCst);
4}4}
55
6// atomicrmw with bool op not .Xchg6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:30: error: @atomicRmw with bool only allowed with .Xchg10// 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 {...@@ -9,6 +9,8 @@ export fn entry() void {
9 _ = @atomicRmw(E, &x, .Add, .b, .SeqCst);9 _ = @atomicRmw(E, &x, .Add, .b, .SeqCst);
10}10}
1111
12// atomicrmw with enum op not .Xchg12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:9:27: error: @atomicRmw with enum only allowed with .Xchg16// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = @atomicRmw(f32, &x, .And, 2, .SeqCst);3 _ = @atomicRmw(f32, &x, .And, 2, .SeqCst);
4}4}
55
6// atomicrmw with float op not .Xchg, .Add or .Sub6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:29: error: @atomicRmw with float only allowed with .Xchg, .Add and .Sub10// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 }4 }
5}5}
66
7// attempt to cast enum literal to error7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:9: error: expected type 'error{Hi}', found '@Type(.EnumLiteral)'11// 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 {...@@ -5,7 +5,9 @@ fn SimpleList(comptime L: usize) type {
5 };5 };
6}6}
77
8// attempt to close over comptime variable from outer scope8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:19: error: mutable 'T' not accessible from here12// tmp.zig:4:19: error: mutable 'T' not accessible from here
11// tmp.zig:2:9: note: declared mutable here13// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = @Type(.{ .Float = .{ .bits = 17 } });3 _ = @Type(.{ .Float = .{ .bits = 17 } });
4}4}
55
6// attempt to create 17 bit float type6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:16: error: 17-bit float unsupported10// 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 {...@@ -7,6 +7,8 @@ export fn entry() void {
7 _ = x;7 _ = x;
8}8}
99
10// attempt to negate a non-integer, non-float or non-vector type10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:6:15: error: negation of type 'anyerror!u32'14// 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 {...@@ -9,7 +9,9 @@ export fn entry2() void {
9 bar(&{});9 bar(&{});
10}10}
1111
12// attempt to use 0 bit type in extern fn12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'16// tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'
15// tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'17// 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 {...@@ -5,6 +5,8 @@ export fn entry(a: bool, b: bool) i32 {
5 return 5678;5 return 5678;
6}6}
77
8// attempted `&&`8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:2:11: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND12// 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 {...@@ -5,7 +5,9 @@ export fn entry(a: bool, b: bool) i32 {
5 return 5678;5 return 5678;
6}6}
77
8// attempted `||` on boolean values8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:2:9: error: expected error set type, found 'bool'12// tmp.zig:2:9: error: expected error set type, found 'bool'
11// tmp.zig:2:11: note: `||` merges error sets; `or` performs boolean OR13// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// attempted implicit cast from T to [*]const T6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:30: error: expected type '[*]const bool', found 'bool'10// 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 {...@@ -6,7 +6,9 @@ export fn entry(byte: u8) void {
6 _ = byte;6 _ = byte;
7}7}
88
9// attempted implicit cast from *const T to *[1]T9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:4:22: error: expected type '*[1]i32', found '*const i32'13// tmp.zig:4:22: error: expected type '*[1]i32', found '*const i32'
12// tmp.zig:4:22: note: cast discards const qualifier14// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 _ = x;4 _ = x;
5}5}
66
7// attempted implicit cast from *const T to []T7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:23: error: expected type '[]u32', found '*const u32'11// 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 {...@@ -4,6 +4,8 @@ comptime {
4 _ = aligned;4 _ = aligned;
5}5}
66
7// bad @alignCast at comptime7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:35: error: pointer address 0x1 is not aligned to 4 bytes11// 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 {...@@ -4,6 +4,8 @@ export fn a() void {
4 _ = y;4 _ = y;
5}5}
66
7// bad alignment in implicit cast from array pointer to slice7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:30: error: expected type '[]align(16) u8', found '*[10]u8'11// 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 {...@@ -7,7 +7,9 @@ export fn entry2() void {
7 _ = x;7 _ = x;
8}8}
99
10// bad alignment type10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:2:20: error: expected type 'u29', found 'bool'14// tmp.zig:2:20: error: expected type 'u29', found 'bool'
13// tmp.zig:6:19: error: fractional component prevents float value 12.340000 from being casted to type 'u29'15// 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 {...@@ -10,6 +10,8 @@ export fn entry() void {
10 _ = Block;10 _ = Block;
11}11}
1212
13// bad identifier in function with struct defined inside function which references local const13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:8:5: error: use of undeclared identifier 'bogus'17// tmp.zig:8:5: error: use of undeclared identifier 'bogus'
test/compile_errors/stage1/obj/bad_import.zig+3-1
...@@ -1,5 +1,7 @@...@@ -1,5 +1,7 @@
1const bogus = @import("bogus-does-not-exist.zig",);1const bogus = @import("bogus-does-not-exist.zig",);
22
3// bad import3// error
4// backend=stage1
5// target=native
4//6//
5// tmp.zig:1:23: error: unable to load '${DIR}bogus-does-not-exist.zig': FileNotFound7// 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 {}...@@ -19,7 +19,9 @@ fn bar() callconv(.Inline) void {}
19fn baz1() void {}19fn baz1() void {}
20fn baz2() void {}20fn baz2() void {}
2121
22// bad usage of @call22// error
23// backend=stage1
24// target=native
23//25//
24// tmp.zig:2:21: error: expected tuple or struct, found 'void'26// tmp.zig:2:21: error: expected tuple or struct, found 'void'
25// tmp.zig:5:14: error: unable to perform 'never_inline' call at compile-time27// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a &= a;3 a &= a;
4}4}
55
6// bin and assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a & a;3 _ = a & a;
4}4}
55
6// bin and on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = ~a;3 _ = ~a;
4}4}
55
6// bin not on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:10: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a |= a;3 a |= a;
4}4}
55
6// bin or assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a | a;3 _ = a | a;
4}4}
55
6// bin or on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a ^= a;3 a ^= a;
4}4}
55
6// bin xor assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a ^ a;3 _ = a ^ a;
4}4}
55
6// bin xor on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 -...@@ -4,6 +4,8 @@ var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE -
44
5export fn entry() usize { return @sizeOf(@TypeOf(block_aligned_stuff)); }5export fn entry() usize { return @sizeOf(@TypeOf(block_aligned_stuff)); }
66
7// binary not on number literal7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:60: error: unable to perform binary not operation on type 'comptime_int'11// 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 {...@@ -3,6 +3,8 @@ export fn entry(byte: u8) void {
3 _ = oops;3 _ = oops;
4}4}
55
6// @bitCast same size but bit count mismatch6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:25: error: destination type 'u7' has 7 bits but source type 'u8' has 8 bits10// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = y;3 _ = y;
4}4}
55
6// bitCast to enum type6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:24: error: cannot cast a value of type 'y'10// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = foo;3 _ = foo;
4}4}
55
6// @bitCast with different sizes inside an expression6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:25: error: destination type 'u8' has size 1 but source type 'f32' has size 410// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// bit shifting only works on integer types6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:16: error: bit shifting operation expected integer type, found '*const u8'10// 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 @@...@@ -1,6 +1,8 @@
1const x = @import("builtin").bogus;1const x = @import("builtin").bogus;
2export fn entry() usize { return @sizeOf(@TypeOf(x)); }2export fn entry() usize { return @sizeOf(@TypeOf(x)); }
33
4// bogus compile var4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:29: error: container 'builtin' has no member called 'bogus'8// 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 {...@@ -4,6 +4,8 @@ fn f(m: []const u8) void {
4}4}
5export fn entry() usize { return @sizeOf(@TypeOf(f)); }5export fn entry() usize { return @sizeOf(@TypeOf(f)); }
66
7// bogus method call on slice7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:6: error: no member named 'copy' in '[]const u8'11// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = !a;3 _ = !a;
4}4}
55
6// bool not on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:10: error: use of undefined value here causes undefined behavior10// 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;...@@ -2,6 +2,8 @@ const x = if (undefined) true else false;
22
3export fn entry() usize { return @sizeOf(@TypeOf(x)); }3export fn entry() usize { return @sizeOf(@TypeOf(x)); }
44
5// branch on undefined value5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:1:15: error: use of undefined value here causes undefined behavior9// 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 @@...@@ -1,7 +1,9 @@
1const c = @cImport(@cInclude("bogus.h"));1const c = @cImport(@cInclude("bogus.h"));
2export fn entry() usize { return @sizeOf(@TypeOf(c.bogo)); }2export fn entry() usize { return @sizeOf(@TypeOf(c.bogo)); }
33
4// @cImport with bogus include4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:11: error: C import failed8// tmp.zig:1:11: error: C import failed
7// .h:1:10: note: 'bogus.h' file not found9// .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 {...@@ -16,7 +16,9 @@ export fn entry1() void {
16 baz = bar(42);16 baz = bar(42);
17}17}
1818
19// call assigned to constant19// error
20// backend=stage1
21// target=native
20//22//
21// tmp.zig:12:14: error: cannot assign to constant23// tmp.zig:12:14: error: cannot assign to constant
22// tmp.zig:16:14: error: cannot assign to constant24// 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 {...@@ -7,6 +7,8 @@ pub fn main() !void {
7 foos[0](true);7 foos[0](true);
8}8}
99
10// calling a generic function only known at runtime10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:7:9: error: calling a generic function requires compile-time known function value14// 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 {...@@ -3,7 +3,9 @@ export fn entry() void {
3}3}
4fn foo() callconv(.Naked) void { }4fn foo() callconv(.Naked) void { }
55
6// calling function with naked calling convention6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:5: error: unable to call function with naked calling convention10// tmp.zig:2:5: error: unable to call function with naked calling convention
9// tmp.zig:4:1: note: declared here11// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3}3}
4pub extern fn foo(format: *const u8, ...) void;4pub extern fn foo(format: *const u8, ...) void;
55
6// calling var args extern function, passing array instead of pointer6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:16: error: expected type '*const u8', found '[5:0]u8'10// 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 {...@@ -6,6 +6,8 @@ export fn foo() void {
6 }6 }
7}7}
88
9// cannot break out of defer expression9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:4:13: error: cannot break out of defer expression13// 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 {...@@ -6,6 +6,8 @@ export fn foo() void {
6 }6 }
7}7}
88
9// cannot continue out of defer expression9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:4:13: error: cannot continue out of defer expression13// 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 {...@@ -12,7 +12,9 @@ comptime {
12 }12 }
13}13}
1414
15// capture group on switch prong with incompatible payload types15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:8:20: error: capture group with incompatible types19// tmp.zig:8:20: error: capture group with incompatible types
18// tmp.zig:8:9: note: type 'usize' here20// 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 {...@@ -7,7 +7,9 @@ export fn entry() void {
7 _ = x;7 _ = x;
8}8}
99
10// cast enum literal to enum but it doesn't match10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:6:20: error: enum 'Foo' has no field named 'c'14// tmp.zig:6:20: error: enum 'Foo' has no field named 'c'
13// tmp.zig:1:13: note: 'Foo' declared here15// 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 {...@@ -7,7 +7,9 @@ fn foo() anyerror!i32 {
7 return error.B;7 return error.B;
8}8}
99
10// cast error union of global error set to error union of smaller error set10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:35: error: expected type 'SmallErrorSet!i32', found 'anyerror!i32'14// tmp.zig:3:35: error: expected type 'SmallErrorSet!i32', found 'anyerror!i32'
13// tmp.zig:3:35: note: error set 'anyerror' cannot cast into error set 'SmallErrorSet'15// 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 {...@@ -7,7 +7,9 @@ fn foo() anyerror {
7 return error.B;7 return error.B;
8}8}
99
10// cast global error set to error set10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:31: error: expected type 'SmallErrorSet', found 'anyerror'14// tmp.zig:3:31: error: expected type 'SmallErrorSet', found 'anyerror'
13// tmp.zig:3:31: note: cannot cast global error set into smaller set15// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// cast negative integer literal to usize6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:26: error: cannot cast negative value -10 to unsigned integer type 'usize'10// 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 {...@@ -9,7 +9,9 @@ export fn entry1() void {
9 _ = unsigned;9 _ = unsigned;
10}10}
1111
12// cast negative value to unsigned integer12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:3:22: error: attempt to cast negative value to unsigned integer16// tmp.zig:3:22: error: attempt to cast negative value to unsigned integer
15// tmp.zig:8:27: error: cannot cast negative value -1 to unsigned integer type 'u32'17// 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 {...@@ -3,7 +3,9 @@ fn f() i32 {
3}3}
4export fn entry() void { _ = f(); }4export fn entry() void { _ = f(); }
55
6// cast unreachable6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:12: error: unreachable code10// tmp.zig:2:12: error: unreachable code
9// tmp.zig:2:21: note: control flow is diverted here11// 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 {...@@ -14,6 +14,8 @@ fn bar(x: *const u3) u3 {
1414
15export fn entry() usize { return @sizeOf(@TypeOf(foo)); }15export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1616
17// casting bit offset pointer to regular pointer17// error
18// backend=stage1
19// target=native
18//20//
19// tmp.zig:8:26: error: expected type '*const u3', found '*align(:3:1) const u3'21// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a catch false;3 _ = a catch false;
4}4}
55
6// catch on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:11: error: use of undefined value here causes undefined behavior10// 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 {...@@ -2,6 +2,8 @@ export fn a(value: u32) bool {
2 return 1 < value < 1000;2 return 1 < value < 1000;
3}3}
44
5// chained comparison operators5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:22: error: comparison operators cannot be chained9// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst);3 _ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst);
4}4}
55
6// cmpxchg with float6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:22: error: expected bool, integer, enum or pointer type, found 'f32'10// 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 {}...@@ -2,7 +2,9 @@ fn func() bogus {}
2fn func() bogus {}2fn func() bogus {}
3export fn entry() usize { return @sizeOf(@TypeOf(func)); }3export fn entry() usize { return @sizeOf(@TypeOf(func)); }
44
5// colliding invalid top level functions5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:1: error: redeclaration of 'func'9// tmp.zig:2:1: error: redeclaration of 'func'
8// tmp.zig:1:1: note: other declaration here10// 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 {...@@ -22,7 +22,9 @@ export fn invalidChildType() void {
22 _ = (x == y);22 _ = (x == y);
23}23}
2424
25// compare optional to non-optional with invalid types25// error
26// backend=stage1
27// target=native
26//28//
27// :4:12: error: cannot compare types '?i32' and 'comptime_int'29// :4:12: error: cannot compare types '?i32' and 'comptime_int'
28// :4:12: note: optional child type 'i32' must be the same as non-optional type 'comptime_int'30// :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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = &x == null;3 _ = &x == null;
4}4}
55
6// comparing a non-optional pointer against null6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:12: error: comparison of '*i32' with null10// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 if (2 == undefined) {}2 if (2 == undefined) {}
3}3}
44
5// comparing against undefined produces undefined value5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:11: error: use of undefined value here causes undefined behavior9// 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 {...@@ -35,7 +35,9 @@ comptime {
35 if (a <= a) x += 1;35 if (a <= a) x += 1;
36}36}
3737
38// comparison operators with undefined value38// error
39// backend=stage1
40// target=native
39//41//
40// tmp.zig:5:11: error: use of undefined value here causes undefined behavior42// tmp.zig:5:11: error: use of undefined value here causes undefined behavior
41// tmp.zig:11:11: error: use of undefined value here causes undefined behavior43// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = number_or_error == error.SomethingAwful;3 _ = number_or_error == error.SomethingAwful;
4}4}
55
6// comparison with error union and error value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:25: error: operator not allowed for type 'anyerror!i32'10// 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 {...@@ -5,6 +5,8 @@ comptime {
5 _ = c;5 _ = c;
6}6}
77
8// compile-time division by zero8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:17: error: division by zero12// 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 {...@@ -5,6 +5,8 @@ comptime {
5 _ = c;5 _ = c;
6}6}
77
8// compile-time remainder division by zero8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:17: error: division by zero12// 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 {...@@ -7,6 +7,8 @@ export fn entry() i32 {
7 return bar;7 return bar;
8}8}
99
10// @compileError shows traceback of references that caused it10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:1:13: error: aoeu14// 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 {...@@ -10,6 +10,8 @@ pub fn main () void {
10 comptime testCompileLog(Bar{.X = 123});10 comptime testCompileLog(Bar{.X = 123});
11}11}
1212
13// compileLog of tagged enum doesn't crash the compiler13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:6:5: error: found compile log statement17// 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 {...@@ -9,6 +9,8 @@ export fn entry() void {
9 _ = x;9 _ = x;
10}10}
1111
12// compile error in struct init expression12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:2:14: error: use of undeclared identifier 'crap'16// 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 {...@@ -7,6 +7,8 @@ export fn entry() void {
7 _ = car;7 _ = car;
8}8}
99
10// compile error when evaluating return type of inferred error set10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:2:11: error: use of undeclared identifier 'SymbolThatDoesNotExist'14// 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 {...@@ -7,7 +7,9 @@ fn bar(a: i32, b: []const u8) void {
7 @compileLog("end",);7 @compileLog("end",);
8}8}
99
10// compile log10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:5:5: error: found compile log statement14// tmp.zig:5:5: error: found compile log statement
13// tmp.zig:6:5: error: found compile log statement15// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 @compileLog(@ptrCast(*const anyopaque, &entry));2 @compileLog(@ptrCast(*const anyopaque, &entry));
3}3}
44
5// compile log a pointer to an opaque value5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: found compile log statement9// 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 {...@@ -7,6 +7,8 @@ export fn entry() void {
7 _ = @typeName(Foo(i32));7 _ = @typeName(Foo(i32));
8}8}
99
10// compile log statement inside function which must be comptime evaluated10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:2:5: error: found compile log statement14// 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 {...@@ -7,6 +7,8 @@ fn inner(comptime n: usize) void {
7 inline while (i < n) : (i += 1) { @compileLog("!@#$"); }7 inline while (i < n) : (i += 1) { @compileLog("!@#$"); }
8}8}
99
10// compile log statement warning deduplication in generic fn10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:7:39: error: found compile log statement14// 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 {...@@ -5,6 +5,8 @@ fn foo(x: u32) u32 {
55
6export fn entry() usize { return @sizeOf(@TypeOf(y)); }6export fn entry() usize { return @sizeOf(@TypeOf(y)); }
77
8// compile time division by zero8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:14: error: division by zero12// 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 {...@@ -9,7 +9,9 @@ export fn entry() void {
9 _ = x;9 _ = x;
10}10}
1111
12// comptime cast enum to union but field has payload12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:8:26: error: cast to union 'Value' must initialize 'i32' field 'A'16// tmp.zig:8:26: error: cast to union 'Value' must initialize 'i32' field 'A'
15// tmp.zig:3:5: note: field 'A' declared here17// 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 {...@@ -8,7 +8,9 @@ fn bad() !void {
8 return error.Bad;8 return error.Bad;
9}9}
1010
11// comptime continue inside runtime catch11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:4:21: error: comptime control flow inside runtime block15// tmp.zig:4:21: error: comptime control flow inside runtime block
14// tmp.zig:4:15: note: runtime block created here16// 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 {...@@ -7,7 +7,9 @@ export fn entry() void {
7 }7 }
8}8}
99
10// comptime continue inside runtime if bool10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:5:22: error: comptime control flow inside runtime block14// tmp.zig:5:22: error: comptime control flow inside runtime block
13// tmp.zig:5:9: note: runtime block created here15// 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 {...@@ -7,7 +7,9 @@ export fn entry() void {
7 }7 }
8}8}
99
10// comptime continue inside runtime if error10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:5:20: error: comptime control flow inside runtime block14// tmp.zig:5:20: error: comptime control flow inside runtime block
13// tmp.zig:5:9: note: runtime block created here15// 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 {...@@ -7,7 +7,9 @@ export fn entry() void {
7 }7 }
8}8}
99
10// comptime continue inside runtime if optional10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:5:20: error: comptime control flow inside runtime block14// tmp.zig:5:20: error: comptime control flow inside runtime block
13// tmp.zig:5:9: note: runtime block created here15// 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 {...@@ -10,7 +10,9 @@ export fn entry() void {
10 }10 }
11}11}
1212
13// comptime continue inside runtime switch13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:6:19: error: comptime control flow inside runtime block17// tmp.zig:6:19: error: comptime control flow inside runtime block
16// tmp.zig:5:9: note: runtime block created here18// 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 {...@@ -7,7 +7,9 @@ export fn entry() void {
7 }7 }
8}8}
99
10// comptime continue inside runtime while bool10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:5:25: error: comptime control flow inside runtime block14// tmp.zig:5:25: error: comptime control flow inside runtime block
13// tmp.zig:5:9: note: runtime block created here15// 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 {...@@ -9,7 +9,9 @@ export fn entry() void {
9 }9 }
10}10}
1111
12// comptime continue inside runtime while error12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:6:13: error: comptime control flow inside runtime block16// tmp.zig:6:13: error: comptime control flow inside runtime block
15// tmp.zig:5:9: note: runtime block created here17// 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 {...@@ -7,7 +7,9 @@ export fn entry() void {
7 }7 }
8}8}
99
10// comptime continue inside runtime while optional10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:5:23: error: comptime control flow inside runtime block14// tmp.zig:5:23: error: comptime control flow inside runtime block
13// tmp.zig:5:9: note: runtime block created here15// 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 {...@@ -2,6 +2,8 @@ export fn foo() void {
2 asm volatile ("" : : [bar]"r"(3.17) : "");2 asm volatile ("" : : [bar]"r"(3.17) : "");
3}3}
44
5// comptime_float in asm input5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:35: error: expected sized integer or sized float, found comptime_float9// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 _ = y;4 _ = y;
5}5}
66
7// comptime implicit cast f64 to f327// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:20: error: cast of value 16777217.000000 to type 'f32' loses information11// 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 {...@@ -2,6 +2,8 @@ export fn foo() void {
2 asm volatile ("" : : [bar]"r"(3) : "");2 asm volatile ("" : : [bar]"r"(3) : "");
3}3}
44
5// comptime_int in asm input5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:35: error: expected sized integer or sized float, found comptime_int9// 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 {...@@ -5,6 +5,8 @@ fn foo() void {
5}5}
6comptime { foo(); }6comptime { foo(); }
77
8// comptime ptrcast of zero-sized type8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:21: error: '*const struct:2:17' and '[*]const u8' do not have the same in-memory representation12// 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 {...@@ -54,7 +54,9 @@ export fn foo_slice() void {
54 }54 }
55}55}
5656
57// comptime slice-sentinel does not match memory at target index (terminated)57// error
58// backend=stage1
59// target=native
58//60//
59// :4:29: error: slice-sentinel does not match memory at target index61// :4:29: error: slice-sentinel does not match memory at target index
60// :12:29: error: slice-sentinel does not match memory at target index62// :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 {...@@ -54,7 +54,9 @@ export fn foo_slice() void {
54 }54 }
55}55}
5656
57// comptime slice-sentinel does not match memory at target index (unterminated)57// error
58// backend=stage1
59// target=native
58//60//
59// :4:29: error: slice-sentinel does not match memory at target index61// :4:29: error: slice-sentinel does not match memory at target index
60// :12:29: error: slice-sentinel does not match memory at target index62// :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 {...@@ -54,7 +54,9 @@ export fn foo_slice() void {
54 }54 }
55}55}
5656
57// comptime slice-sentinel does not match target-sentinel57// error
58// backend=stage1
59// target=native
58//60//
59// :4:29: error: slice-sentinel does not match target-sentinel61// :4:29: error: slice-sentinel does not match target-sentinel
60// :12:29: error: slice-sentinel does not match target-sentinel62// :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 {...@@ -54,7 +54,9 @@ export fn foo_slice() void {
54 }54 }
55}55}
5656
57// comptime slice-sentinel is out of bounds (terminated)57// error
58// backend=stage1
59// target=native
58//60//
59// :4:29: error: out of bounds slice61// :4:29: error: out of bounds slice
60// :12:29: error: out of bounds slice62// :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 {...@@ -54,7 +54,9 @@ export fn foo_slice() void {
54 }54 }
55}55}
5656
57// comptime slice-sentinel is out of bounds (unterminated)57// error
58// backend=stage1
59// target=native
58//60//
59// :4:29: error: slice-sentinel is out of bounds61// :4:29: error: slice-sentinel is out of bounds
60// :12:29: error: slice-sentinel is out of bounds62// :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 {...@@ -4,6 +4,8 @@ comptime {
4 _ = b;4 _ = b;
5}5}
66
7// comptime slice of an undefined slice7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:14: error: slice of undefined11// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = slice;3 _ = slice;
4}4}
55
6// comptime slice of undefined pointer non-zero len6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:41: error: non-zero length slice of undefined pointer10// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 _ = f;6 _ = f;
7}7}
88
9// comptime struct field, no init value9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:2:5: error: comptime field without default initialization value13// 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 {...@@ -11,7 +11,9 @@ fn func() void {
11 suspend {}11 suspend {}
12}12}
1313
14// const frame cast to anyframe14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:3:12: error: expected type 'anyframe', found '*const @Frame(func)'18// tmp.zig:3:12: error: expected type 'anyframe', found '*const @Frame(func)'
17// tmp.zig:7:24: error: expected type 'anyframe', found '*const @Frame(func)'19// 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 {...@@ -2,6 +2,8 @@ export fn f() void {
2 (const a = 0);2 (const a = 0);
3}3}
44
5// const is a statement, not an expression5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:6: error: expected expression, found 'const'9// 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};...@@ -3,6 +3,8 @@ const a = zero{1};
33
4export fn entry() usize { return @sizeOf(@TypeOf(a)); }4export fn entry() usize { return @sizeOf(@TypeOf(a)); }
55
6// container init with non-type6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:11: error: expected type 'type', found 'i32'10// 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 {...@@ -7,7 +7,9 @@ export fn foo() void {
77
8fn bar() void { }8fn bar() void { }
99
10// control flow uses comptime var at runtime10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:5: error: control flow attempts to use compile-time variable at runtime14// tmp.zig:3:5: error: control flow attempts to use compile-time variable at runtime
13// tmp.zig:3:24: note: compile-time variable assigned here15// 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 @@...@@ -1,6 +1,8 @@
1fn a() i32 {}1fn a() i32 {}
2export fn entry() void { _ = a(); }2export fn entry() void { _ = a(); }
33
4// control reaches end of non-void function4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:12: error: expected type 'i32', found 'void'8// 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 {...@@ -15,7 +15,9 @@ comptime {
15 _ = S;15 _ = S;
16}16}
1717
18// declaration between fields18// error
19// backend=stage1
20// target=native
19//21//
20// tmp.zig:9:5: error: declarations are not allowed between container fields22// tmp.zig:9:5: error: declarations are not allowed between container fields
21// tmp.zig:5:5: note: field before declarations here23// 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 {...@@ -4,7 +4,9 @@ export fn entry() void {
4 _ = a;4 _ = a;
5}5}
66
7// declaration with same name as primitive must use special syntax7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:1:7: error: name shadows primitive 'u8'11// tmp.zig:1:7: error: name shadows primitive 'u8'
10// tmp.zig:1:7: note: consider using @"u8" to disambiguate12// 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 {...@@ -5,6 +5,8 @@ export fn b() void {
5 x += 1;5 x += 1;
6}6}
77
8// deduplicate undeclared identifier8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:2:5: error: use of undeclared identifier 'x'12// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a.*;3 _ = a.*;
4}4}
55
6// deref on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: attempt to dereference undefined value10// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = a.*.len;3 _ = a.*.len;
4}4}
55
6// deref slice and get len field6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:10: error: attempt to dereference non-pointer type '[]u8'10// 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 {...@@ -7,6 +7,8 @@ pub fn pass(in: []u8) []u8 {
77
8export fn entry() usize { return @sizeOf(@TypeOf(pass)); }8export fn entry() usize { return @sizeOf(@TypeOf(pass)); }
99
10// dereference an array10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:4:10: error: attempt to dereference non-pointer type '[10]u8'14// 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 {...@@ -2,6 +2,8 @@ export fn entry(x: [*]i32) i32 {
2 return x.*;2 return x.*;
3}3}
44
5// dereference unknown length pointer5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:13: error: index syntax required for unknown-length pointer type '[*]i32'9// 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 @@...@@ -1,6 +1,8 @@
1const A = struct { a : A, };1const A = struct { a : A, };
2export fn entry() usize { return @sizeOf(A); }2export fn entry() usize { return @sizeOf(A); }
33
4// direct struct loop4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:11: error: struct 'A' depends on itself8// 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 {...@@ -20,7 +20,9 @@ export fn c() void {
20 _ = qux;20 _ = qux;
21}21}
2222
23// directly embedding opaque type in struct and union23// error
24// backend=stage1
25// target=native
24//26//
25// tmp.zig:3:5: error: opaque types have unknown size and therefore cannot be directly embedded in structs27// tmp.zig:3:5: error: opaque types have unknown size and therefore cannot be directly embedded in structs
26// tmp.zig:7:5: error: opaque types have unknown size and therefore cannot be directly embedded in unions28// 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 {...@@ -5,6 +5,8 @@ pub fn main() void {
5 _ = puts(no_zero_ptr);5 _ = puts(no_zero_ptr);
6}6}
77
8// disallow coercion from non-null-terminated pointer to null-terminated pointer8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:5:14: error: expected type '[*:0]const u8', found '[*]const u8'12// 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 {...@@ -5,6 +5,8 @@ fn foo() !void {
5 return error.OutOfMemory;5 return error.OutOfMemory;
6}6}
77
8// discarding error value8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:2:12: error: error is discarded. consider using `try`, `catch`, or `if`12// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a /= a;3 a /= a;
4}4}
55
6// div assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a / a;3 _ = a / a;
4}4}
55
6// div on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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)); }...@@ -8,7 +8,9 @@ export fn entry2() usize { return @sizeOf(@TypeOf(lit_float_x)); }
8export fn entry3() usize { return @sizeOf(@TypeOf(int_x)); }8export fn entry3() usize { return @sizeOf(@TypeOf(int_x)); }
9export fn entry4() usize { return @sizeOf(@TypeOf(float_x)); }9export fn entry4() usize { return @sizeOf(@TypeOf(float_x)); }
1010
11// division by zero11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:1:21: error: division by zero15// tmp.zig:1:21: error: division by zero
14// tmp.zig:2:25: error: division by zero16// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 _ = ptr2;6 _ = ptr2;
7}7}
88
9// don't implicit cast double pointer to *anyopaque9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:29: error: expected type '*anyopaque', found '**u32'13// 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 @@...@@ -1,6 +1,8 @@
1pub fn main() ??void {1pub fn main() ??void {
2}2}
33
4// double ?? on main return value4// error
5// backend=stage1
6// target=native
5//7//
6// error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'8// 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 {...@@ -15,7 +15,9 @@ comptime {
15 _ = x;15 _ = x;
16}16}
1717
18// duplicate boolean switch value18// error
19// backend=stage1
20// target=native
19//21//
20// tmp.zig:5:9: error: duplicate switch value22// tmp.zig:5:9: error: duplicate switch value
21// tmp.zig:13:9: error: duplicate switch value23// 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 {...@@ -8,7 +8,9 @@ export fn entry() void {
8 _ = a;8 _ = a;
9}9}
1010
11// duplicate enum field11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:3:5: error: duplicate enum field: 'Bar'15// tmp.zig:3:5: error: duplicate enum field: 'Bar'
14// tmp.zig:2:5: note: other field here16// 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 {...@@ -14,7 +14,9 @@ fn foo(x: i32) !void {
14 }14 }
15}15}
1616
17// duplicate error in switch17// error
18// backend=stage1
19// target=native
18//20//
19// tmp.zig:5:14: error: duplicate switch value: '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set.Foo'21// tmp.zig:5:14: error: duplicate switch value: '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set.Foo'
20// tmp.zig:3:14: note: other value here22// 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 {...@@ -7,7 +7,9 @@ export fn entry() void {
7 _ = a;7 _ = a;
8}8}
99
10// duplicate error value in error set10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:5: error: duplicate error set field 'Bar'14// tmp.zig:3:5: error: duplicate error set field 'Bar'
13// tmp.zig:2:5: note: previous declaration here15// 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 {...@@ -13,6 +13,8 @@ export fn f() void {
13 _ = a;13 _ = a;
14}14}
1515
16// duplicate field in struct value expression16// error
17// backend=stage1
18// target=native
17//19//
18// tmp.zig:11:9: error: duplicate field20// 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 {...@@ -7,7 +7,9 @@ export fn entry() void {
7 _ = a;7 _ = a;
8}8}
99
10// duplicate struct field10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:5: error: duplicate struct field: 'Bar'14// tmp.zig:3:5: error: duplicate struct field: 'Bar'
13// tmp.zig:2:5: note: other field here15// 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 {...@@ -7,7 +7,9 @@ export fn entry() void {
7 _ = a;7 _ = a;
8}8}
99
10// duplicate union field10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:5: error: duplicate union field: 'Bar'14// tmp.zig:3:5: error: duplicate union field: 'Bar'
13// tmp.zig:2:5: note: other field here15// 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",);...@@ -2,6 +2,8 @@ const resource = @embedFile("bogus.txt",);
22
3export fn entry() usize { return @sizeOf(@TypeOf(resource)); }3export fn entry() usize { return @sizeOf(@TypeOf(resource)); }
44
5// @embedFile with bogus file5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:1:29: error: unable to find '9// 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 {...@@ -2,6 +2,8 @@ export fn a() void {
2 for(undefined) |x|;2 for(undefined) |x|;
3}3}
44
5// empty for loop body5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:23: error: expected block or assignment, found ';'9// 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 {...@@ -2,6 +2,8 @@ export fn a() void {
2 if(true);2 if(true);
3}3}
44
5// empty if body5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:13: error: expected block or assignment, found ';'9// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 switch(x) {}3 switch(x) {}
4}4}
55
6// empty switch on an integer6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: switch must handle all possibilities10// 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 {...@@ -2,6 +2,8 @@ export fn a() void {
2 while(true);2 while(true);
3}3}
44
5// empty while loop body5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:16: error: expected block or assignment, found ';'9// 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 {...@@ -5,6 +5,8 @@ fn fibonacci(x: i32) i32 {
55
6export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); }6export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); }
77
8// endless loop in function evaluation8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:21: error: evaluation exceeded 1000 backwards branches12// 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 {...@@ -8,6 +8,8 @@ export fn entry() void {
8}8}
9const D = 1;9const D = 1;
1010
11// enum field value references enum11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:1:17: error: enum 'Foo' depends on itself15// 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 {...@@ -7,7 +7,9 @@ export fn entry() void {
7 _ = x;7 _ = x;
8}8}
99
10// enum in field count range but not matching tag10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:6:13: error: enum 'Foo' has no tag matching integer value 014// tmp.zig:6:13: error: enum 'Foo' has no tag matching integer value 0
13// tmp.zig:1:13: note: 'Foo' declared here15// 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 {...@@ -10,7 +10,9 @@ export fn entry() void {
10 _ = x;10 _ = x;
11}11}
1212
13// enum value already taken13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:6:5: error: enum tag value 60 already taken17// tmp.zig:6:5: error: enum tag value 60 already taken
16// tmp.zig:4:5: note: other occurrence here18// tmp.zig:4:5: note: other occurrence here
test/compile_errors/stage1/obj/enum_with_0_fields.zig+3-1
...@@ -1,5 +1,7 @@...@@ -1,5 +1,7 @@
1const Foo = enum {};1const Foo = enum {};
22
3// enum with 0 fields3// error
4// backend=stage1
5// target=native
4//6//
5// tmp.zig:1:13: error: enum declarations must have at least one tag7// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 _ = @Type(@typeInfo(enum { foo, const bar = 1; }));2 _ = @Type(@typeInfo(enum { foo, const bar = 1; }));
3}3}
44
5// enum with declarations unavailable for @Type5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:15: error: Type.Enum.decls must be empty for @Type9// 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 {...@@ -9,6 +9,8 @@ fn foo(x: Set1) void {
9 }9 }
10}10}
1111
12// error equality but sets have no common members12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:7:11: error: error sets 'Set1' and 'Set2' have no common errors16// 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 {...@@ -12,7 +12,9 @@ fn foo(x: i32) !void {
12 }12 }
13}13}
1414
15// error not handled in switch15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:2:26: error: error.Baz not handled in switch19// tmp.zig:2:26: error: error.Baz not handled in switch
18// tmp.zig:2:26: error: error.Bar not handled in switch20// 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 {...@@ -4,7 +4,9 @@ export fn entry() void {
4 do_the_thing(bar);4 do_the_thing(bar);
5}5}
66
7// error note for function parameter incompatibility7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:4:18: error: expected type 'fn(i32) void', found 'fn(bool) void11// tmp.zig:4:18: error: expected type 'fn(i32) void', found 'fn(bool) void
10// tmp.zig:4:18: note: parameter 0: 'bool' cannot cast into 'i32'12// 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 {...@@ -4,6 +4,8 @@ comptime {
4 _ = x;4 _ = x;
5}5}
66
7// error union operator with non error set LHS7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:2:15: error: expected error set type, found type 'i32'11// 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 {...@@ -10,6 +10,8 @@ export fn entry() void {
10 _ = rule_set;10 _ = rule_set;
11}11}
1212
13// error when evaluating return type13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:2:19: error: expected type 'i32', found 'type'17// 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 {...@@ -7,7 +7,9 @@ export fn entry2() void {
7 _ = x;7 _ = x;
8}8}
99
10// exceeded maximum bit width of integer10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:2:15: error: primitive integer type 'u65536' exceeds maximum bit width of 6553514// tmp.zig:2:15: error: primitive integer type 'u65536' exceeds maximum bit width of 65535
13// tmp.zig:6:12: error: primitive integer type 'i65536' exceeds maximum bit width of 6553515// 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 {...@@ -2,6 +2,8 @@ export fn entry() i32 {
2 return @as(i32, 12.34);2 return @as(i32, 12.34);
3}3}
44
5// explicit cast float literal to integer when there is a fraction component5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:21: error: fractional component prevents float value 12.340000 from being casted to type 'i32'9// 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 {...@@ -6,6 +6,8 @@ comptime {
6 _ = y;6 _ = y;
7}7}
88
9// explicit error set cast known at comptime violates error sets9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:13: error: error.B not a member of error set 'Set2'13// 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 {...@@ -11,6 +11,8 @@ export fn entry() void {
11 _ = x;11 _ = x;
12}12}
1313
14// explicitly casting non tag type to enum14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:10:31: error: expected integer type, found 'f32'18// 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{...@@ -2,6 +2,8 @@ export fn foo(comptime x: i32, y: i32) i32{
2 return x + y;2 return x + y;
3}3}
44
5// export function with comptime parameter5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C'9// 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 {...@@ -3,6 +3,8 @@ export fn foo(num: anytype) i32 {
3 return 0;3 return 0;
4}4}
55
6// export generic function6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:1:15: error: parameter of type 'anytype' not allowed in function with calling convention 'C'10// 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 @@...@@ -1,5 +1,7 @@
1export fn foo() callconv(.Async) void {}1export fn foo() callconv(.Async) void {}
22
3// exported async function3// error
4// backend=stage1
5// target=native
4//6//
5// tmp.zig:1:1: error: exported function cannot be async7// 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 {...@@ -7,7 +7,9 @@ comptime {
7 @export(e, .{ .name = "e" });7 @export(e, .{ .name = "e" });
8}8}
99
10// exported enum without explicit integer tag type10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:13: error: exported enum without explicit integer tag type14// tmp.zig:3:13: error: exported enum without explicit integer tag type
13// tmp.zig:7:13: error: exported enum value without explicit integer tag type15// 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;}...@@ -5,6 +5,8 @@ export fn c(x: i32) i32 {return x + 2;}
55
6export fn entry() usize { return @sizeOf(@TypeOf(fns)); }6export fn entry() usize { return @sizeOf(@TypeOf(fns)); }
77
8// extern function pointer mismatch8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:1:37: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32'12// 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 {...@@ -4,6 +4,8 @@ fn f() i32 {
4}4}
5export fn entry() usize { return @sizeOf(@TypeOf(f)); }5export fn entry() usize { return @sizeOf(@TypeOf(f)); }
66
7// extern function with comptime parameter7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C'11// 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 {...@@ -36,6 +36,8 @@ export fn entry() void {
36 _ = s;36 _ = s;
37}37}
3838
39// extern struct with extern-compatible but inferred integer tag type39// error
40// backend=stage1
41// target=native
40//42//
41// tmp.zig:31:5: error: extern structs cannot contain fields of type 'E'43// 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 {...@@ -7,6 +7,8 @@ export fn entry() void {
7 _ = s;7 _ = s;
8}8}
99
10// extern struct with non-extern-compatible integer tag type10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:5: error: extern structs cannot contain fields of type 'E'14// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 _ = a;6 _ = a;
7}7}
88
9// extern union field missing type9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:2:5: error: union field missing type13// 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 {...@@ -13,6 +13,8 @@ export fn entry() void {
13 _ = a;13 _ = a;
14}14}
1515
16// extern union given enum tag type16// error
17// backend=stage1
18// target=native
17//19//
18// tmp.zig:6:30: error: extern union does not support enum tag type20// 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 {...@@ -3,6 +3,8 @@ pub export fn entry() void {
3 foo;3 foo;
4}4}
55
6// extern variable has no type6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:1:8: error: unable to infer variable type10// 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 {...@@ -5,6 +5,8 @@ export fn foo(a: *i32) *Foo {
5 return @fieldParentPtr(Foo, "a", a);5 return @fieldParentPtr(Foo, "a", a);
6}6}
77
8// @fieldParentPtr - bad field name8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:5:33: error: struct 'Foo' has no field 'a'12// 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 {...@@ -10,6 +10,8 @@ comptime {
10 _ = another_foo_ptr;10 _ = another_foo_ptr;
11}11}
1212
13// @fieldParentPtr - comptime field ptr not based on struct13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:9:55: error: pointer value not based on parent struct17// 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 {...@@ -9,6 +9,8 @@ comptime {
9 _ = another_foo_ptr;9 _ = another_foo_ptr;
10}10}
1111
12// @fieldParentPtr - comptime wrong field index12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:8:29: error: field 'b' has index 1 but pointer value is index 0 of struct 'Foo'16// 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 {...@@ -5,6 +5,8 @@ export fn foo(a: i32) *Foo {
5 return @fieldParentPtr(Foo, "a", a);5 return @fieldParentPtr(Foo, "a", a);
6}6}
77
8// @fieldParentPtr - field pointer is not pointer8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:5:38: error: expected pointer, found 'i32'12// 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 {...@@ -3,6 +3,8 @@ export fn foo(a: *i32) *Foo {
3 return @fieldParentPtr(Foo, "a", a);3 return @fieldParentPtr(Foo, "a", a);
4}4}
55
6// @fieldParentPtr - non struct6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:28: error: expected struct type, found 'i32'10// 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 {...@@ -9,6 +9,8 @@ fn bar(x: *MyType) bool {
9 return x.blah;9 return x.blah;
10}10}
1111
12// field access of opaque type12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:9:13: error: no member named 'blah' in opaque type 'MyType'16// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 _ = info;4 _ = info;
5}5}
66
7// field access of slices7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:32: error: type 'type' does not support field access11// 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 {...@@ -6,6 +6,8 @@ export fn entry(foo: [*]Foo) void {
6 foo.a += 1;6 foo.a += 1;
7}7}
88
9// field access of unknown length pointer9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:6:8: error: type '[*]Foo' does not support field access13// 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 {...@@ -4,7 +4,9 @@ const Letter = enum {
4 C,4 C,
5};5};
66
7// field type supplied in an enum7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:2:8: error: enum fields do not have types11// tmp.zig:2:8: error: enum fields do not have types
10// tmp.zig:1:16: note: consider 'union(enum)' here to make it a tagged union12// 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 {...@@ -8,7 +8,9 @@ comptime {
8 _ = @floatToInt(u8, @as(f32, 256.1));8 _ = @floatToInt(u8, @as(f32, 256.1));
9}9}
1010
11// @floatToInt comptime safety11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:2:9: error: integer value '-129' cannot be stored in type 'i8'15// tmp.zig:2:9: error: integer value '-129' cannot be stored in type 'i8'
14// tmp.zig:5:9: error: integer value '-1' cannot be stored in type 'u8'16// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a;3 _ = a;
4}4}
55
6// float literal too large error6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: float literal out of range of any type10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a;3 _ = a;
4}4}
55
6// float literal too small error (denormal)6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: float literal out of range of any type10// 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 {...@@ -10,7 +10,9 @@ export fn f2() void {
10 _ = x;10 _ = x;
11}11}
1212
13// for loop body expression ignored13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:5:30: error: expression value is ignored17// tmp.zig:5:30: error: expression value is ignored
16// tmp.zig:9:30: error: expression value is ignored18// 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 {...@@ -4,6 +4,8 @@ export fn entry() bool {
4 return handle_undef == handle_dummy;4 return handle_undef == handle_dummy;
5}5}
66
7// @frame() called outside of function definition7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:2:30: error: @frame() called outside of function definition11// 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 {...@@ -5,7 +5,9 @@ fn func() void {
5 _ = @frame();5 _ = @frame();
6}6}
77
8// @frame() causes function to be async8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:1:1: error: function with calling convention 'C' cannot be async12// tmp.zig:1:1: error: function with calling convention 'C' cannot be async
11// tmp.zig:5:9: note: @frame() causes function to be async13// 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 @@...@@ -1,6 +1,8 @@
1extern fn foo() align(3) void;1extern fn foo() align(3) void;
2export fn entry() void { return foo(); }2export fn entry() void { return foo(); }
33
4// function alignment non power of 24// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:23: error: alignment value 3 is not a power of 28// 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 {...@@ -6,6 +6,8 @@ fn concat() [16]f32 {
6 return [1]f32{0}**16;6 return [1]f32{0}**16;
7}7}
88
9// function call assigned to incorrect type9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:3:17: error: expected type '[4]f32', found '[16]f32'13// 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 {...@@ -19,7 +19,9 @@ export fn entry4() void {
19 _ = bar;19 _ = bar;
20}20}
2121
22// function parameter is opaque22// error
23// backend=stage1
24// target=native
23//25//
24// tmp.zig:3:28: error: parameter of opaque type 'FooType' not allowed26// tmp.zig:3:28: error: parameter of opaque type 'FooType' not allowed
25// tmp.zig:8:28: error: parameter of type '@Type(.Null)' not allowed27// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 foo();3 foo();
4}4}
55
6// function prototype with no body6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:1:1: error: non-extern function has no body10// 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) {...@@ -9,7 +9,9 @@ export fn baz() !@TypeOf(undefined) {
9 return error.InvalidValue;9 return error.InvalidValue;
10}10}
1111
12// function returning opaque type12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:2:18: error: Opaque return type 'FooType' not allowed16// tmp.zig:2:18: error: Opaque return type 'FooType' not allowed
15// tmp.zig:1:1: note: type declared here17// 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 {...@@ -8,7 +8,9 @@ fn bar() void {
8 suspend {}8 suspend {}
9}9}
1010
11// function with ccc indirectly calling async function11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:1:1: error: function with calling convention 'C' cannot be async15// tmp.zig:1:1: error: function with calling convention 'C' cannot be async
14// tmp.zig:2:8: note: async function call here16// 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 @@...@@ -1,5 +1,7 @@
1export fn foo() boid {}1export fn foo() boid {}
22
3// function with invalid return type3// error
4// backend=stage1
5// target=native
4//6//
5// tmp.zig:1:17: error: use of undeclared identifier 'boid'7// 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 @@...@@ -1,6 +1,8 @@
1const Foo = enum { A, B, C };1const Foo = enum { A, B, C };
2export fn entry(foo: Foo) void { _ = foo; }2export fn entry(foo: Foo) void { _ = foo; }
33
4// function with non-extern non-packed enum parameter4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:2:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C'8// 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 {...@@ -5,6 +5,8 @@ const Foo = struct {
5};5};
6export fn entry(foo: Foo) void { _ = foo; }6export fn entry(foo: Foo) void { _ = foo; }
77
8// function with non-extern non-packed struct parameter8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C'12// 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 {...@@ -5,6 +5,8 @@ const Foo = union {
5};5};
6export fn entry(foo: Foo) void { _ = foo; }6export fn entry(foo: Foo) void { _ = foo; }
77
8// function with non-extern non-packed union parameter8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C'12// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 f(g);4 f(g);
5}5}
66
7// generic fn as parameter without comptime keyword7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:1:9: error: parameter of type 'fn(anytype) anytype' must be declared comptime11// 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{...@@ -6,6 +6,8 @@ fn myAlloc(comptime arg: type) anyerror!arg{
6 unreachable;6 unreachable;
7}7}
88
9// generic function call assigned to incorrect type9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:3:18: error: expected type '[]i32', found 'anyerror!i3213// 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 {...@@ -5,6 +5,8 @@ fn test1(a: i32, b: i32) i32 {
55
6export fn entry() usize { return @sizeOf(@TypeOf(test1)); }6export fn entry() usize { return @sizeOf(@TypeOf(test1)); }
77
8// generic function instance with non-constant expression8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:16: error: runtime value cannot be passed to comptime arg12// 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 {...@@ -12,7 +12,9 @@ export fn baz() void {
12 _ = generic(@TypeOf(undefined));12 _ = generic(@TypeOf(undefined));
13}13}
1414
15// generic function returning opaque type15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed19// tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed
18// tmp.zig:2:1: note: function declared here20// 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 {...@@ -8,6 +8,8 @@ export fn entry() void {
8 _ = t;8 _ = t;
9}9}
1010
11// generic function where return type is self-referenced11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches15// 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 @@...@@ -1,6 +1,8 @@
1const some_data: [100]u8 align(3) = undefined;1const some_data: [100]u8 align(3) = undefined;
2export fn entry() usize { return @sizeOf(@TypeOf(some_data)); }2export fn entry() usize { return @sizeOf(@TypeOf(some_data)); }
33
4// global variable alignment non power of 24// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:32: error: alignment value 3 is not a power of 28// 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;...@@ -2,6 +2,8 @@ extern fn foo() i32;
2const x = foo();2const x = foo();
3export fn entry() i32 { return x; }3export fn entry() i32 { return x; }
44
5// global variable initializer must be constant expression5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:11: error: unable to evaluate constant expression9// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 _ = @hasDecl(i32, "hi");2 _ = @hasDecl(i32, "hi");
3}3}
44
5// @hasDecl with non-container5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:18: error: expected struct, enum, or union; found 'i32'9// 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 {...@@ -2,6 +2,8 @@ export fn f() void {
2 if (0) {}2 if (0) {}
3}3}
44
5// if condition is bool, not int5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:9: error: expected type 'bool', found 'comptime_int'9// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3}3}
4fn bar() anyerror!i32 { return 0; }4fn bar() anyerror!i32 { return 0; }
55
6// ignored assert-err-ok return value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:11: error: expression value is ignored10// 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 {...@@ -2,6 +2,8 @@ export fn foo() void {
2 comptime {1;}2 comptime {1;}
3}3}
44
5// ignored comptime statement value5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:15: error: expression value is ignored9// 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 {...@@ -2,6 +2,8 @@ export fn foo() void {
2 comptime 1;2 comptime 1;
3}3}
44
5// ignored comptime value5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: expression value is ignored9// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3}3}
4fn bar() anyerror!i32 { return 0; }4fn bar() anyerror!i32 { return 0; }
55
6// ignored deferred function call6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:14: error: error is ignored. consider using `try`, `catch`, or `if`10// 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 {...@@ -2,6 +2,8 @@ export fn foo() void {
2 defer {1;}2 defer {1;}
3}3}
44
5// ignored deferred statement value5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:12: error: expression value is ignored9// 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 {...@@ -13,7 +13,9 @@ fn bad() anyerror!void {
13 return error.Bad;13 return error.Bad;
14}14}
1515
16// ignored expression in while continuation16// error
17// backend=stage1
18// target=native
17//19//
18// tmp.zig:2:24: error: error is ignored. consider using `try`, `catch`, or `if`20// tmp.zig:2:24: error: error is ignored. consider using `try`, `catch`, or `if`
19// tmp.zig:6:25: error: error is ignored. consider using `try`, `catch`, or `if`21// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3}3}
4fn bar() i32 { return 0; }4fn bar() i32 { return 0; }
55
6// ignored return value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:8: error: expression value is ignored10// 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 {...@@ -2,6 +2,8 @@ export fn foo() void {
2 1;2 1;
3}3}
44
5// ignored statement value5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: expression value is ignored9// 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 {...@@ -12,7 +12,9 @@ fn bad_eql_2(a: *const EnumWithData, b: *const EnumWithData) bool {
12export fn entry1() usize { return @sizeOf(@TypeOf(bad_eql_1)); }12export fn entry1() usize { return @sizeOf(@TypeOf(bad_eql_1)); }
13export fn entry2() usize { return @sizeOf(@TypeOf(bad_eql_2)); }13export fn entry2() usize { return @sizeOf(@TypeOf(bad_eql_2)); }
1414
15// illegal comparison of types15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:2:14: error: operator not allowed for type '[]u8'19// tmp.zig:2:14: error: operator not allowed for type '[]u8'
18// tmp.zig:9:16: error: operator not allowed for type 'EnumWithData'20// 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 {...@@ -29,7 +29,9 @@ export fn f() void {
29 _ = x;29 _ = x;
30}30}
3131
32// implicit cast between C pointer and Zig pointer - bad const/align/child32// error
33// backend=stage1
34// target=native
33//35//
34// tmp.zig:3:27: error: cast increases pointer alignment36// tmp.zig:3:27: error: cast increases pointer alignment
35// tmp.zig:8:18: error: cast discards const qualifier37// 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 {...@@ -4,7 +4,9 @@ export fn entry() void {
4 _ = sliceA;4 _ = sliceA;
5}5}
66
7// implicit cast const array to mutable slice7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:27: error: cannot cast pointer to array literal to slice type '[]u8'11// tmp.zig:3:27: error: cannot cast pointer to array literal to slice type '[]u8'
10// tmp.zig:3:27: note: cast discards const qualifier12// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 foo(global_array);4 foo(global_array);
5}5}
66
7// implicit cast from array to mutable slice7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:4:9: error: expected type '[]i32', found '[10]i32'11// 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;...@@ -3,6 +3,8 @@ var y: f32 = x;
33
4export fn entry() usize { return @sizeOf(@TypeOf(y)); }4export fn entry() usize { return @sizeOf(@TypeOf(y)); }
55
6// implicit cast from f64 to f326// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:14: error: expected type 'f32', found 'f64'10// 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 {...@@ -8,7 +8,9 @@ fn foo(set1: Set1) void {
8 _ = x;8 _ = x;
9}9}
1010
11// implicit cast of error set not a subset11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:7:19: error: expected type 'Set2', found 'Set1'15// tmp.zig:7:19: error: expected type 'Set2', found 'Set1'
14// tmp.zig:1:23: note: 'error.B' not a member of destination error set16// 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 {...@@ -14,7 +14,9 @@ export fn entry2() void {
14 _ = c_ptr;14 _ = c_ptr;
15}15}
1616
17// implicit casting C pointers which would mess up null semantics17// error
18// backend=stage1
19// target=native
18//20//
19// tmp.zig:6:24: error: expected type '*const [*]const u8', found '[*c]const [*c]const u8'21// tmp.zig:6:24: error: expected type '*const [*]const u8', found '[*c]const [*c]const u8'
20// tmp.zig:6:24: note: pointer type child '[*c]const u8' cannot cast into pointer type child '[*]const u8'22// 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 {...@@ -4,6 +4,8 @@ comptime {
4 _ = zig_ptr;4 _ = zig_ptr;
5}5}
66
7// implicit casting null c pointer to zig pointer7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:24: error: null pointer casted to type '*u8'11// 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 {...@@ -8,7 +8,9 @@ export fn b() void {
8 _ = ptr;8 _ = ptr;
9}9}
1010
11// implicit casting too big integers to C pointers11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:2:33: error: integer value 18446744073709551617 cannot be coerced to type 'usize'15// tmp.zig:2:33: error: integer value 18446744073709551617 cannot be coerced to type 'usize'
14// tmp.zig:7:23: error: integer type 'u65' too big for implicit @intToPtr to type '[*c]u8'16// 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 {...@@ -4,6 +4,8 @@ comptime {
4 _ = zig_ptr;4 _ = zig_ptr;
5}5}
66
7// implicit casting undefined c pointer to zig pointer7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:24: error: use of undefined value here causes undefined behavior11// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - block expr8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:11: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - block statement8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:9: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - comptime expression8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:20: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - comptime statement8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:18: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - defer8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:15: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - for expression8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:26: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - for statement8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:24: error: expected ';' or 'else' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - if-else-if-else expression8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:45: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - if-else-if-else statement8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:47: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - if-else-if expression8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:37: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - if-else-if statement8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:37: error: expected ';' or 'else' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - if-else expression8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:28: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - if-else statement8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:28: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - if expression8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:20: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - if statement8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:18: error: expected ';' or 'else' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - test expression8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:26: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - test statement8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:24: error: expected ';' or 'else' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - while-continue expression8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:28: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - while-continue statement8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:26: error: expected ';' or 'else' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - while expression8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:23: error: expected ';' after statement12// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 var bad = {};5 var bad = {};
6}6}
77
8// implicit semicolon - while statement8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:18: error: expected ';' or 'else' after statement12// 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 {...@@ -10,6 +10,8 @@ export fn entry() void {
10 _ = x;10 _ = x;
11}11}
1212
13// implicitly casting enum to tag type13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:9:22: error: expected type 'u2', found 'Small'17// 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 {...@@ -12,6 +12,8 @@ fn bar(x: *u32) void {
12 x.* += 1;12 x.* += 1;
13}13}
1414
15// implicitly increasing pointer alignment15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:8:13: error: expected type '*u32', found '*align(1) u32'19// 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 {...@@ -13,7 +13,9 @@ fn bar(x: []u32) void {
13 x[0] += 1;13 x[0] += 1;
14}14}
1515
16// implicitly increasing slice alignment16// error
17// backend=stage1
18// target=native
17//19//
18// tmp.zig:9:26: error: cast increases pointer alignment20// tmp.zig:9:26: error: cast increases pointer alignment
19// tmp.zig:9:26: note: '*align(1) u32' has alignment 121// 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{...@@ -2,6 +2,8 @@ comptime{
2 _ = @import("../a.zig");2 _ = @import("../a.zig");
3}3}
44
5// import outside package path5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:9: error: import of file outside package path: '../a.zig'9// 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 @@...@@ -14,6 +14,8 @@
14 unreachable;14 unreachable;
15 }15 }
1616
17// incorrect return type17// error
18// backend=stage1
19// target=native
18//20//
19// tmp.zig:8:16: error: expected type 'A', found 'B'21// 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 {...@@ -4,7 +4,9 @@ export fn entry() u32 {
4 return ptr.*;4 return ptr.*;
5}5}
66
7// increase pointer alignment in @ptrCast7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:17: error: cast increases pointer alignment11// tmp.zig:3:17: error: cast increases pointer alignment
10// tmp.zig:3:38: note: '*u8' has alignment 112// 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 {...@@ -3,6 +3,8 @@ comptime {
3 slice[0] = 2;3 slice[0] = 2;
4}4}
55
6// indexing a undefined slice at comptime6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:10: error: index 0 outside slice of size 010// 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 {...@@ -4,6 +4,8 @@ export fn foo() void {
4 _ = pointer;4 _ = pointer;
5}5}
66
7// indexing an array of size zero7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:27: error: accessing a zero length array is not allowed11// 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 {...@@ -5,6 +5,8 @@ export fn foo() void {
5 _ = pointer;5 _ = pointer;
6}6}
77
8// indexing an array of size zero with runtime index8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:27: error: accessing a zero length array is not allowed12// 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 {...@@ -2,6 +2,8 @@ export fn entry(ptr: *i32) i32 {
2 return ptr[1];2 return ptr[1];
3}3}
44
5// indexing single-item pointer5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:15: error: index of single-item pointer9// 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 {...@@ -27,7 +27,9 @@ fn rangeSumIndirect(x: i32) i32 {
27 return child + 1;27 return child + 1;
28}28}
2929
30// indirect recursion of async functions detected30// error
31// backend=stage1
32// target=native
31//33//
32// tmp.zig:8:1: error: '@Frame(rangeSum)' depends on itself34// tmp.zig:8:1: error: '@Frame(rangeSum)' depends on itself
33// tmp.zig:15:33: note: when analyzing type '@Frame(rangeSum)' here35// 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, };...@@ -3,6 +3,8 @@ const B = struct { c : C, };
3const C = struct { a : A, };3const C = struct { a : A, };
4export fn entry() usize { return @sizeOf(A); }4export fn entry() usize { return @sizeOf(A); }
55
6// indirect struct loop6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:1:11: error: struct 'A' depends on itself10// 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 {...@@ -8,7 +8,9 @@ export fn entry2() void {
8 _ = a;8 _ = a;
9}9}
1010
11// inferred array size invalid here11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:2:16: error: unable to infer array size15// tmp.zig:2:16: error: unable to infer array size
14// tmp.zig:6:35: error: unable to infer array size16// 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 {...@@ -2,6 +2,8 @@ comptime {
2 const z: ?fn()!void = null;2 const z: ?fn()!void = null;
3}3}
44
5// inferring error set of function pointer5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:19: error: function prototype may not have inferred error set9// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// initializing array with struct syntax6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: initializing array with struct syntax10// 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 {...@@ -8,6 +8,8 @@ export fn entry() usize {
8 return @sizeOf(@TypeOf(foo.x));8 return @sizeOf(@TypeOf(foo.x));
9}9}
1010
11// instantiating an undefined value for an invalid struct that contains itself11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:1:13: error: struct 'Foo' depends on itself15// 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 {...@@ -3,6 +3,8 @@ pub fn main() void {
3 _ = y;3 _ = y;
4}4}
55
6// intToPtr with misaligned address6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:13: error: pointer type '[*]align(4) u8' requires aligned address10// 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 {...@@ -8,6 +8,8 @@ comptime {
8 _ = y;8 _ = y;
9}9}
1010
11// int to err global invalid number11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:7:13: error: integer value 3 represents no error15// 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 {...@@ -12,6 +12,8 @@ comptime {
12 _ = y;12 _ = y;
13}13}
1414
15// int to err non global invalid number15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:11:13: error: error.B not a member of error set 'Set2'19// 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 {...@@ -4,6 +4,8 @@ export fn foo() void {
4 _ = y;4 _ = y;
5}5}
66
7// int to ptr of 0 bits7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:30: error: type '*void' has 0 bits and cannot store information11// 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 {...@@ -19,7 +19,9 @@ export fn entry4() void {
19 _ = unsigned;19 _ = unsigned;
20}20}
2121
22// integer cast truncates bits22// error
23// backend=stage1
24// target=native
23//25//
24// tmp.zig:3:18: error: cast from 'u16' to 'u8' truncates bits26// tmp.zig:3:18: error: cast from 'u16' to 'u8' truncates bits
25// tmp.zig:8:22: error: integer value 300 cannot be coerced to type 'u8'27// 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 @@...@@ -1,6 +1,8 @@
1const x : u8 = 300;1const x : u8 = 300;
2export fn entry() usize { return @sizeOf(@TypeOf(x)); }2export fn entry() usize { return @sizeOf(@TypeOf(x)); }
33
4// integer overflow error4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:16: error: integer value 300 cannot be coerced to type 'u8'8// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 _ = @intToPtr(*anyopaque, ~@as(usize, @import("std").math.maxInt(usize)) - 1);2 _ = @intToPtr(*anyopaque, ~@as(usize, @import("std").math.maxInt(usize)) - 1);
3}3}
44
5// integer underflow error5// error
6// backend=stage1
7// target=native
6//8//
7// :2:78: error: operation caused overflow9// :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 {...@@ -2,6 +2,8 @@ export fn f() void {
2 break;2 break;
3}3}
44
5// invalid break expression5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: break expression outside loop9// 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) {...@@ -2,6 +2,8 @@ fn f() @bogus(foo) {
2}2}
3export fn entry() void { _ = f(); }3export fn entry() void { _ = f(); }
44
5// invalid builtin fn5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:1:8: error: invalid builtin function: '@bogus'9// 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 {...@@ -10,6 +10,8 @@ fn foo(x: usize) void {
10 }10 }
11}11}
1212
13// invalid cast from integral type to enum13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:9:10: error: expected type 'usize', found 'E'17// 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;...@@ -3,6 +3,8 @@ const invalid = foo > foo;
33
4export fn entry() usize { return @sizeOf(@TypeOf(invalid)); }4export fn entry() usize { return @sizeOf(@TypeOf(invalid)); }
55
6// invalid comparison for function pointers6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: operator not allowed for type 'fn() void'10// 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 {...@@ -2,6 +2,8 @@ export fn f() void {
2 continue;2 continue;
3}3}
44
5// invalid continue expression5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: continue expression outside loop9// 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 {...@@ -10,6 +10,8 @@ const Tile = enum {
10 Filled,10 Filled,
11};11};
1212
13// invalid deref on switch target13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:3:17: error: attempt to dereference non-pointer type 'Tile'17// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 const a = '\u{}';2 const a = '\u{}';
3}3}
44
5// invalid empty unicode escape5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:19: error: empty unicode escape sequence9// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid exponent in float literal - 16// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:28: note: invalid byte: 'a'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid exponent in float literal - 26// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:29: note: invalid byte: 'F'11// 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 @@...@@ -1,5 +1,7 @@
1comptime { var x = doesnt_exist.whatever; _ = x; }1comptime { var x = doesnt_exist.whatever; _ = x; }
22
3// invalid field access in comptime3// error
4// backend=stage1
5// target=native
4//6//
5// tmp.zig:1:20: error: use of undeclared identifier 'doesnt_exist'7// 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 {...@@ -12,6 +12,8 @@ export fn f() void {
12 _ = a;12 _ = a;
13}13}
1414
15// invalid field in struct value expression15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:10:9: error: no member named 'foo' in struct 'A'19// 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 {...@@ -6,6 +6,8 @@ pub fn main() void {
6 std.debug.assert(bad_float < 1.0);6 std.debug.assert(bad_float < 1.0);
7}7}
88
9// invalid float literal9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:29: error: expected expression, found '.'13// 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 {...@@ -2,7 +2,9 @@ export fn entry() void {
2 const a = '\U1234';2 const a = '\U1234';
3}3}
44
5// invalid legacy unicode escape5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:15: error: expected expression, found 'invalid bytes'9// tmp.zig:2:15: error: expected expression, found 'invalid bytes'
8// tmp.zig:2:18: note: invalid byte: '1'10// 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 {...@@ -2,6 +2,8 @@ export fn f() void {
2 if (true) |x| { _ = x; }2 if (true) |x| { _ = x; }
3}3}
44
5// invalid maybe type5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:9: error: expected optional type, found 'bool'9// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 _ = foo;4 _ = foo;
5}5}
66
7// invalid member of builtin enum7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:29: error: container 'std.builtin.Mode' has no member called 'x86'11// 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 {...@@ -11,7 +11,9 @@ pub const Box = struct {
11 field: i32,11 field: i32,
12};12};
1313
14// invalid multiple dereferences14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:3:8: error: attempt to dereference non-pointer type 'Box'18// tmp.zig:3:8: error: attempt to dereference non-pointer type 'Box'
17// tmp.zig:8:13: error: attempt to dereference non-pointer type 'Box'19// 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 {...@@ -3,6 +3,8 @@ const stroo = extern struct {
3};3};
4export fn testf(fluff: *stroo) void { _ = fluff; }4export fn testf(fluff: *stroo) void { _ = fluff; }
55
6// invalid optional type in extern struct6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:5: error: extern structs cannot contain fields of type '?[*c]u8'10// 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 {...@@ -6,6 +6,8 @@ export fn f() void {
6 }6 }
7}7}
88
9// invalid pointer for var type9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:2:13: error: unable to evaluate constant expression13// 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 {...@@ -2,6 +2,8 @@ export fn foo() void {
2 var guid: *:0 const u8 = undefined;2 var guid: *:0 const u8 = undefined;
3}3}
44
5// invalid pointer syntax5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:16: error: expected type expression, found ':'9// 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 {...@@ -4,6 +4,8 @@ fn f() u16 {
4}4}
5export fn entry() u16 { return f(); }5export fn entry() u16 { return f(); }
66
7// invalid shift amount error7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:17: error: integer value 8 cannot be coerced to type 'u3'11// 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 {...@@ -11,7 +11,9 @@ export fn g() void {
11 _ = y;11 _ = y;
12}12}
1313
14// invalid struct field14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:4:6: error: no member named 'foo' in struct 'A'18// tmp.zig:4:6: error: no member named 'foo' in struct 'A'
17// tmp.zig:10:16: error: no member named 'bar' in struct 'A'19// 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 {...@@ -7,7 +7,9 @@ fn func() void {
7 suspend {}7 suspend {}
8}8}
99
10// invalid suspend in exported function10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:1:1: error: function with calling convention 'C' cannot be async14// tmp.zig:1:1: error: function with calling convention 'C' cannot be async
13// tmp.zig:3:18: note: await here is a suspend point15// 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 @@...@@ -1,6 +1,8 @@
1fn a() bogus {}1fn a() bogus {}
2export fn entry() void { _ = a(); }2export fn entry() void { _ = a(); }
33
4// invalid type4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:8: error: use of undeclared identifier 'bogus'8// 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 {...@@ -7,6 +7,8 @@ export fn entry() void {
7 _ = a;7 _ = a;
8}8}
99
10// invalid type used in array type10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:2:12: error: use of undeclared identifier 'SomeNonexistentType'14// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 16// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:23: note: invalid byte: '_'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 106// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:25: note: invalid byte: '_'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 116// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:28: note: invalid byte: '_'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 126// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:23: note: invalid byte: 'x'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 136// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:23: note: invalid byte: '_'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 146// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:27: note: invalid byte: 'p'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 26// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:23: note: invalid byte: '.'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 36// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:25: note: invalid byte: ';'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 46// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:25: note: invalid byte: '_'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 56// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:26: note: invalid byte: '_'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 66// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:26: note: invalid byte: '_'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 76// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:28: note: invalid byte: ';'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in float literal - 96// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:23: note: invalid byte: '_'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in int literal - 16// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:26: note: invalid byte: ';'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in int literal - 26// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:28: note: invalid byte: ';'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in int literal - 36// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:28: note: invalid byte: ';'11// 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 {...@@ -3,7 +3,9 @@ fn main() void {
3 _ = bad;3 _ = bad;
4}4}
55
6// invalid underscore placement in int literal - 46// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: expected expression, found 'invalid bytes'10// tmp.zig:2:21: error: expected expression, found 'invalid bytes'
9// tmp.zig:2:28: note: invalid byte: ';'11// 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 {...@@ -8,6 +8,8 @@ comptime {
8 _ = bar_val;8 _ = bar_val;
9}9}
1010
11// invalid union field access in comptime11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:7:24: error: accessing union field 'Bar' while field 'Baz' is set15// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = foo;3 _ = foo;
4}4}
55
6// compile diagnostic string for top level decl type (issue 2032)6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:27: error: type 'u32' does not support array initialization10// 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 {...@@ -18,7 +18,9 @@ export fn foo3() void {
18 }18 }
19}19}
2020
21// issue #2687: coerce from undefined array pointer to slice21// error
22// backend=stage1
23// target=native
22//24//
23// tmp.zig:3:19: error: use of undefined value here causes undefined behavior25// tmp.zig:3:19: error: use of undefined value here causes undefined behavior
24// tmp.zig:9:23: error: use of undefined value here causes undefined behavior26// 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 {...@@ -9,7 +9,9 @@ export fn foo2() void {
9 _ = word;9 _ = word;
10}10}
1111
12// issue #3818: bitcast from parray/slice to u1612// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:3:42: error: unable to @bitCast from pointer type '*[2]u8'16// tmp.zig:3:42: error: unable to @bitCast from pointer type '*[2]u8'
15// tmp.zig:8:32: error: destination type 'u16' has size 2 but source type '[]const u8' has size 1617// 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 {...@@ -3,7 +3,9 @@ export fn foo() [*:0]const u8 {
3 return buffer[0..];3 return buffer[0..];
4}4}
55
6// issue #4207: coerce from non-terminated-slice to terminated-pointer6// error
7// backend=stage1
8// target=native
7//9//
8// :3:18: error: expected type '[*:0]const u8', found '*[64]u8'10// :3:18: error: expected type '[*:0]const u8', found '*[64]u8'
9// :3:18: note: destination pointer requires a terminating '0' sentinel11// :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 {...@@ -8,7 +8,9 @@ export fn foo() void {
8 comptime ignore(@typeInfo(MyStruct).Struct.fields[0]);8 comptime ignore(@typeInfo(MyStruct).Struct.fields[0]);
9}9}
1010
11// issue #5221: invalid struct init type referenced by @typeInfo and passed into function11// error
12// backend=stage1
13// target=native
12//14//
13// :5:28: error: cannot cast pointer to array literal to slice type '[]u8'15// :5:28: error: cannot cast pointer to array literal to slice type '[]u8'
14// :5:28: note: cast discards const qualifier16// :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 {...@@ -4,6 +4,8 @@ export fn foo() void {
4 v = u;4 v = u;
5}5}
66
7// Issue #5618: coercion of ?*anyopaque to *anyopaque must fail.7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:4:9: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type '*anyopaque', found '?*anyopaque'11// 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 {...@@ -7,6 +7,8 @@ export fn foo_slice_len_increment_beyond_bounds() void {
7 }7 }
8}8}
99
10// comptime slice-len increment beyond bounds10// error
11// backend=stage1
12// target=native
11//13//
12// :6:12: error: out of bounds slice14// :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 @@...@@ -1,5 +1,7 @@
1pub const empty = return 1;1pub const empty = return 1;
22
3// issue #9346: return outside of function scope3// error
4// backend=stage1
5// target=native
4//6//
5// tmp.zig:1:19: error: 'return' outside function scope7// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 }6 }
7}7}
88
9// labeled break not found9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:4:20: error: label not found: 'outer'13// 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 {...@@ -7,6 +7,8 @@ export fn entry() void {
7 }7 }
8}8}
99
10// labeled continue not found10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:5:23: error: label not found: 'outer'14// 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 {...@@ -5,6 +5,8 @@ export fn foo() void {
5 _ = I;5 _ = I;
6}6}
77
8// lazy pointer with undefined element type8// error
9// backend=stage1
10// target=native
9//11//
10// :3:28: error: use of undefined value here causes undefined behavior12// :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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 _ = int_val;6 _ = int_val;
7}7}
88
9// load too many bytes from comptime reinterpreted pointer9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:28: error: attempt to read 8 bytes from pointer to f32 which is 4 bytes13// 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 {...@@ -10,6 +10,8 @@ fn loadv(ptr: anytype) i32 {
10 return ptr.*;10 return ptr.*;
11}11}
1212
13// load vector pointer with unknown runtime index13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:10:12: error: unable to determine vector element index of type '*align(16:0:4:?) i3217// 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 {...@@ -4,7 +4,9 @@ pub fn main() void {
4}4}
5fn foo() void {}5fn foo() void {}
66
7// local shadows global that occurs later7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:2:9: error: local shadows declaration of 'foo'11// tmp.zig:2:9: error: local shadows declaration of 'foo'
10// tmp.zig:5:1: note: declared here12// 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 {...@@ -3,7 +3,9 @@ export fn f() void {
3 var a = 0;3 var a = 0;
4}4}
55
6// local variable redeclaration6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: redeclaration of local constant 'a'10// tmp.zig:3:9: error: redeclaration of local constant 'a'
9// tmp.zig:2:11: note: previous declaration here11// 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 {...@@ -3,7 +3,9 @@ fn f(a : i32) void {
3}3}
4export fn entry() void { f(1); }4export fn entry() void { f(1); }
55
6// local variable redeclares parameter6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:11: error: redeclaration of function parameter 'a'10// tmp.zig:2:11: error: redeclaration of function parameter 'a'
9// tmp.zig:1:6: note: previous declaration here11// 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 {...@@ -6,7 +6,9 @@ export fn entry() void {
6 _ = Bar;6 _ = Bar;
7}7}
88
9// local variable shadowing global9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:9: error: local shadows declaration of 'Bar'13// tmp.zig:5:9: error: local shadows declaration of 'Bar'
12// tmp.zig:2:1: note: declared here14// 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 {...@@ -4,7 +4,9 @@ export fn foo() void {
4 _ = a;4 _ = a;
5}5}
66
7// locally shadowing a primitive type7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:2:11: error: name shadows primitive 'u8'11// tmp.zig:2:11: error: name shadows primitive 'u8'
10// tmp.zig:2:11: note: consider using @"u8" to disambiguate12// 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 @@...@@ -1,5 +1,7 @@
1pub fn main(args: [][]bogus) !void {_ = args;}1pub fn main(args: [][]bogus) !void {_ = args;}
22
3// main function with bogus args type3// error
4// backend=stage1
5// target=native
4//6//
5// tmp.zig:1:23: error: use of undeclared identifier 'bogus'7// 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 {...@@ -14,6 +14,8 @@ export fn f() void {
14 derp.init();14 derp.init();
15}15}
1616
17// method call with first arg type primitive17// error
18// backend=stage1
19// target=native
18//20//
19// tmp.zig:14:5: error: expected type 'i32', found 'Foo'21// 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 {...@@ -23,6 +23,8 @@ export fn foo() void {
23 x.init();23 x.init();
24}24}
2525
26// method call with first arg type wrong container26// error
27// backend=stage1
28// target=native
27//29//
28// tmp.zig:23:5: error: expected type '*Allocator', found '*List'30// 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 {...@@ -11,7 +11,9 @@ comptime {
11 _ = x;11 _ = x;
12}12}
1313
14// missing boolean switch value14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:2:15: error: switch must handle all possibilities18// tmp.zig:2:15: error: switch must handle all possibilities
17// tmp.zig:8:15: error: switch must handle all possibilities19// 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 {...@@ -11,6 +11,8 @@ export fn entry() void {
11 _ = geo_data;11 _ = geo_data;
12}12}
1313
14// missing const in slice with nested array type14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:4:30: error: array literal requires address-of operator (&) to coerce to slice type '[][2]f32'18// 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 {...@@ -8,7 +8,9 @@ fn g(b: bool) void {
8}8}
9export fn entry() void { f(true); g(true); }9export fn entry() void { f(true); g(true); }
1010
11// missing else clause11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:2:21: error: expected type 'i32', found 'void'15// tmp.zig:2:21: error: expected type 'i32', found 'void'
14// tmp.zig:6:15: error: incompatible types: 'i32' and 'void'16// 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 {...@@ -13,6 +13,8 @@ export fn f() void {
13 _ = a;13 _ = a;
14}14}
1515
16// missing field in struct value expression16// error
17// backend=stage1
18// target=native
17//19//
18// tmp.zig:9:17: error: missing field: 'x'20// 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 {...@@ -24,6 +24,8 @@ fn f(foo: *const Foo, index: usize) void {
2424
25export fn entry() usize { return @sizeOf(@TypeOf(f)); }25export fn entry() usize { return @sizeOf(@TypeOf(f)); }
2626
27// missing function call param27// error
28// backend=stage1
29// target=native
28//30//
29// tmp.zig:20:34: error: expected 1 argument(s), found 031// 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 @@...@@ -1,6 +1,8 @@
1fn () void {}1fn () void {}
2export fn entry() usize { return @sizeOf(@TypeOf(f)); }2export fn entry() usize { return @sizeOf(@TypeOf(f)); }
33
4// missing function name4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:1: error: missing function name8// tmp.zig:1:1: error: missing function name
test/compile_errors/stage1/obj/missing_param_name.zig+3-1
...@@ -1,6 +1,8 @@...@@ -1,6 +1,8 @@
1fn f(i32) void {}1fn f(i32) void {}
2export fn entry() usize { return @sizeOf(@TypeOf(f)); }2export fn entry() usize { return @sizeOf(@TypeOf(f)); }
33
4// missing param name4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:6: error: missing parameter name8// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 dump(a);4 dump(a);
5}5}
66
7// missing parameter name of generic function7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:1:9: error: missing parameter name11// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 foo() catch 0;5 foo() catch 0;
6}6}
77
8// missing result type for phi node8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:5:17: error: integer value 0 cannot be coerced to type 'void'12// 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 {...@@ -30,6 +30,8 @@ fn foo() void {
3030
31export fn entry() usize { return @sizeOf(@TypeOf(foo)); }31export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
3232
33// misspelled type with pointer only reference33// error
34// backend=stage1
35// target=native
34//36//
35// tmp.zig:5:16: error: use of undeclared identifier 'JsonList'37// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a %= a;3 a %= a;
4}4}
55
6// mod assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a % a;3 _ = a % a;
4}4}
55
6// mod on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -5,6 +5,8 @@ fn mul(a: u16, b: u16) u16 {
55
6export fn entry() usize { return @sizeOf(@TypeOf(y)); }6export fn entry() usize { return @sizeOf(@TypeOf(y)); }
77
8// mul overflow in function evaluation8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:14: error: operation caused overflow12// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a *= a;3 a *= a;
4}4}
55
6// mult assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a * a;3 _ = a * a;
4}4}
55
6// mult on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a *%= a;3 a *%= a;
4}4}
55
6// mult wrap assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a *% a;3 _ = a *% a;
4}4}
55
6// mult wrap on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {}...@@ -2,7 +2,9 @@ fn a() void {}
2fn a() void {}2fn a() void {}
3export fn entry() void { a(); }3export fn entry() void { a(); }
44
5// multiple function definitions5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:1: error: redeclaration of 'a'9// tmp.zig:2:1: error: redeclaration of 'a'
8// tmp.zig:1:1: note: other declaration here10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = -a;3 _ = -a;
4}4}
55
6// negate on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:10: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = -%a;3 _ = -%a;
4}4}
55
6// negate wrap on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:11: error: use of undefined value here causes undefined behavior10// 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 {...@@ -5,6 +5,8 @@ fn neg(x: i8) i8 {
55
6export fn entry() usize { return @sizeOf(@TypeOf(y)); }6export fn entry() usize { return @sizeOf(@TypeOf(y)); }
77
8// negation overflow in function evaluation8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:12: error: negation caused overflow12// 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 {...@@ -10,7 +10,9 @@ fn foo() ?OtherError!i32 {
10 return null;10 return null;
11}11}
1212
13// nested error set mismatch13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:5:34: error: expected type '?NextError!i32', found '?OtherError!i32'17// tmp.zig:5:34: error: expected type '?NextError!i32', found '?OtherError!i32'
16// tmp.zig:5:34: note: optional type child 'OtherError!i32' cannot cast into optional type child 'NextError!i32'18// 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 {...@@ -7,6 +7,8 @@ fn foo(a: anyerror) void {
7 }7 }
8}8}
99
10// no else prong on switch on global error set10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:5:5: error: else prong required when switching on type 'anyerror'14// 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 @@...@@ -1,6 +1,8 @@
1fn f(noalias x: i32) void { _ = x; }1fn f(noalias x: i32) void { _ = x; }
2export fn entry() void { f(1234); }2export fn entry() void { f(1234); }
33
4// noalias on non pointer param4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:6: error: noalias on non-pointer parameter8// 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 {...@@ -6,7 +6,9 @@ fn func() void {
6 suspend {}6 suspend {}
7}7}
88
9// non-async function pointer eventually is inferred to become async9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:1: error: 'func' cannot be async13// tmp.zig:5:1: error: 'func' cannot be async
12// tmp.zig:3:20: note: required to be non-async here14// 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;...@@ -10,6 +10,8 @@ var global_side_effect = false;
1010
11export fn entry() usize { return @sizeOf(@TypeOf(a)); }11export fn entry() usize { return @sizeOf(@TypeOf(a)); }
1212
13// non-const expression function call with struct return value outside function13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:6:26: error: unable to evaluate constant expression17// 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;...@@ -6,6 +6,8 @@ extern fn get_it() i32;
66
7export fn entry() usize { return @sizeOf(@TypeOf(a)); }7export fn entry() usize { return @sizeOf(@TypeOf(a)); }
88
9// non-const expression in struct literal outside function9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:4:21: error: unable to evaluate constant expression13// 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 {...@@ -10,6 +10,8 @@ fn bar() i32 {
10 return 2;10 return 2;
11}11}
1212
13// non-const switch number literal13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:5:17: error: cannot store runtime value in type 'comptime_int'17// 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 {...@@ -35,7 +35,9 @@ const Foo = struct {
35 fn bar(self: *const Foo) void {_ = self;}35 fn bar(self: *const Foo) void {_ = self;}
36};36};
3737
38// non-const variables of things that require const variables38// error
39// backend=stage1
40// target=native
39//41//
40// tmp.zig:2:4: error: variable of type '*const comptime_int' must be const or comptime42// tmp.zig:2:4: error: variable of type '*const comptime_int' must be const or comptime
41// tmp.zig:6:4: error: variable of type '@Type(.Undefined)' must be const or comptime43// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 _ = x;6 _ = x;
7}7}
88
9// non-enum tag type passed to union9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:1:19: error: expected enum tag type, found 'u32'13// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 foo();3 foo();
4}4}
55
6// non-extern function with var args6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:1:14: error: expected type expression, found '...'10// 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 {...@@ -7,6 +7,8 @@ export fn entry() void {
7 for (xx) |f| { _ = f;}7 for (xx) |f| { _ = f;}
8}8}
99
10// non-inline for loop on a type that requires comptime10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:7:5: error: values of type 'Foo' must be comptime known, but index value is runtime known14// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 _ = x;6 _ = x;
7}7}
88
9// non-integer tag type to automatic union enum9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:1:24: error: expected integer tag type, found 'f32'13// 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 {...@@ -17,6 +17,8 @@ export fn function_with_return_type_type() void {
17 list.length = 10;17 list.length = 10;
18}18}
1919
20// non-pure function returns type20// error
21// backend=stage1
22// target=native
21//23//
22// tmp.zig:3:7: error: unable to evaluate constant expression24// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5}5}
6fn afunc() void { }6fn afunc() void { }
77
8// non async function pointer passed to @asyncCall8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:32: error: expected async function, found 'fn() void'12// 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 {...@@ -4,6 +4,8 @@ fn f() []u8 {
4var s: [10]u8 = undefined;4var s: [10]u8 = undefined;
5export fn entry() usize { return @sizeOf(@TypeOf(f)); }5export fn entry() usize { return @sizeOf(@TypeOf(f)); }
66
7// non compile time array concatenation7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:2:12: error: unable to evaluate constant expression11// 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; }...@@ -6,7 +6,9 @@ fn get() usize { return global_var; }
66
7export fn entry() usize { return @sizeOf(@TypeOf(Foo)); }7export fn entry() usize { return @sizeOf(@TypeOf(Foo)); }
88
9// non constant expression in array size9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:25: error: cannot store runtime value in compile time variable13// tmp.zig:5:25: error: cannot store runtime value in compile time variable
12// tmp.zig:2:12: note: called from here14// 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 {...@@ -7,7 +7,9 @@ export fn bar() void {
7 _ = Errors;7 _ = Errors;
8}8}
99
10// non error sets used in merge error sets operator10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:2:20: error: expected error set type, found type 'u8'14// tmp.zig:2:20: error: expected error set type, found type 'u8'
13// tmp.zig:2:23: note: `||` merges error sets; `or` performs boolean OR15// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// non float passed to @floatToInt6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:32: error: expected float type, found 'i32'10// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// non int passed to @intToFloat6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:32: error: expected int type, found 'comptime_float'10// 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 {...@@ -2,6 +2,8 @@ export fn entry(x: i32) usize {
2 return @ptrToInt(x);2 return @ptrToInt(x);
3}3}
44
5// non pointer given to @ptrToInt5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:22: error: expected pointer, found 'i32'9// 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 @@...@@ -1,7 +1,9 @@
1const foo = "a1const foo = "a
2b";2b";
33
4// normal string with newline4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:13: error: expected expression, found 'invalid bytes'8// tmp.zig:1:13: error: expected expression, found 'invalid bytes'
7// tmp.zig:1:15: note: invalid byte: '\n'9// 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 {...@@ -5,6 +5,8 @@ export fn foo() usize {
5 return @offsetOf(Foo, "a",);5 return @offsetOf(Foo, "a",);
6}6}
77
8// @offsetOf - bad field name8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:5:27: error: struct 'Foo' has no field 'a'12// 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 {...@@ -3,6 +3,8 @@ export fn foo() usize {
3 return @offsetOf(Foo, "a",);3 return @offsetOf(Foo, "a",);
4}4}
55
6// @offsetOf - non struct6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:22: error: expected struct type, found 'i32'10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = z;3 _ = z;
4}4}
55
6// only equality binary operator allowed for error sets6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:23: error: operator not allowed for errors10// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 _ = foo;4 _ = foo;
5}5}
66
7// opaque type with field7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:1:25: error: opaque types cannot have fields11// 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 {...@@ -7,6 +7,8 @@ const Bar = extern struct {
7};7};
8export fn entry(bar: *Bar) void {_ = bar;}8export fn entry(bar: *Bar) void {_ = bar;}
99
10// optional pointer to void in extern struct10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:2:5: error: extern structs cannot contain fields of type '?*const void'14// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a or a;3 _ = a or a;
4}4}
55
6// or on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a orelse false;3 _ = a orelse false;
4}4}
55
6// orelse on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:11: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// out of range comptime_int passed to @floatToInt6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:31: error: integer value 200 cannot be coerced to type 'i8'10// 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 {...@@ -7,6 +7,8 @@ pub fn main() void {
7 _ = y;7 _ = y;
8}8}
99
10// overflow in enum value allocation10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:5: error: enumeration value 256 too large for type 'u8'14// 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 {...@@ -13,6 +13,8 @@ export fn entry() void {
13 _ = a;13 _ = a;
14}14}
1515
16// packed union given enum tag type16// error
17// backend=stage1
18// target=native
17//19//
18// tmp.zig:6:30: error: packed union does not support enum tag type20// 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 {...@@ -11,6 +11,8 @@ export fn entry() void {
11 _ = a;11 _ = a;
12}12}
1313
14// packed union with automatic layout field14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:6:5: error: non-packed, non-extern struct 'Foo' not allowed in packed union; no guaranteed in-memory representation18// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 }4 }
5}5}
66
7// @panic called at compile time7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:9: error: encountered @panic at compile-time11// 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 {...@@ -2,7 +2,9 @@ fn f(a : i32, a : i32) void {
2}2}
3export fn entry() void { f(1, 2); }3export fn entry() void { f(1, 2); }
44
5// parameter redeclaration5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:1:15: error: redeclaration of function parameter 'a'9// tmp.zig:1:15: error: redeclaration of function parameter 'a'
8// tmp.zig:1:6: note: previous declaration here10// 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 {...@@ -4,7 +4,9 @@ export fn entry() void {
4 f(1234);4 f(1234);
5}5}
66
7// parameter shadowing global7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:2:6: error: local shadows declaration of 'Foo'11// tmp.zig:2:6: error: local shadows declaration of 'Foo'
10// tmp.zig:1:1: note: declared here12// 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 {...@@ -10,6 +10,8 @@ fn ptrEql(a: *[]const u8, b: *[]const u8) bool {
1010
11export fn entry() usize { return @sizeOf(@TypeOf(foo)); }11export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1212
13// pass const ptr to mutable ptr fn13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:4:19: error: expected type '*[]const u8', found '*const []const u8'17// 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 {...@@ -5,6 +5,8 @@ export fn entry() bool {
5 return x == 5678;5 return x == 5678;
6}6}
77
8// passing a not-aligned-enough pointer to cmpxchg8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:32: error: expected type '*i32', found '*align(1) i32'12// 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 {...@@ -6,6 +6,8 @@ fn testImplicitlyDecreaseFnAlign(ptr: fn () align(8) i32, answer: i32) void {
6}6}
7fn alignedSmall() align(4) i32 { return 1234; }7fn alignedSmall() align(4) i32 { return 1234; }
88
9// passing an under-aligned function pointer9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:2:35: error: expected type 'fn() align(8) i32', found 'fn() align(4) i32'13// 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 {...@@ -3,7 +3,9 @@ export fn func() void {
3 strValue = strValue orelse "";3 strValue = strValue orelse "";
4}4}
55
6// peer cast then implicit cast const pointer to mutable C pointer6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:32: error: expected type '[*c]u8', found '*const [0:0]u8'10// tmp.zig:3:32: error: expected type '[*c]u8', found '*const [0:0]u8'
9// tmp.zig:3:32: note: cast discards const qualifier11// 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 {...@@ -5,6 +5,8 @@ export fn foo() void {
5 _ = z;5 _ = z;
6}6}
77
8// pointer arithmetic on pointer-to-array8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:4:17: error: integer value 1 cannot be coerced to type '*[10]u8'12// 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 {...@@ -12,7 +12,9 @@ comptime {
12 _ = c;12 _ = c;
13}13}
1414
15// pointer attributes checked when coercing pointer to anon literal15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:2:31: error: cannot cast pointer to array literal to slice type '[][]const u8'19// tmp.zig:2:31: error: cannot cast pointer to array literal to slice type '[][]const u8'
18// tmp.zig:2:31: note: cast discards const qualifier20// tmp.zig:2:31: note: cast discards const qualifier
test/compile_errors/stage1/obj/pointer_to_noreturn.zig+3-1
...@@ -1,6 +1,8 @@...@@ -1,6 +1,8 @@
1fn a() *noreturn {}1fn a() *noreturn {}
2export fn entry() void { _ = a(); }2export fn entry() void { _ = a(); }
33
4// pointer to noreturn4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:9: error: pointer to noreturn not allowed8// 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 {...@@ -2,6 +2,8 @@ export fn entry(x: f32) u32 {
2 return @popCount(f32, x);2 return @popCount(f32, x);
3}3}
44
5// @popCount - non-integer5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:22: error: expected integer type, found 'f32'9// 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 {...@@ -15,7 +15,9 @@ export fn c() void {
15}15}
16fn func() void {}16fn func() void {}
1717
18// prevent bad implicit casting of anyframe types18// error
19// backend=stage1
20// target=native
19//21//
20// tmp.zig:3:28: error: expected type 'anyframe->i32', found 'anyframe'22// tmp.zig:3:28: error: expected type 'anyframe->i32', found 'anyframe'
21// tmp.zig:8:28: error: expected type 'anyframe->i32', found 'i32'23// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 _ = a;4 _ = a;
5}5}
66
7// primitives take precedence over declarations7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:19: error: integer value 300 cannot be coerced to type 'u8'11// 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 {...@@ -4,7 +4,9 @@ export fn entry() bool {
4 return p == null;4 return p == null;
5}5}
66
7// @ptrCast a 0 bit type to a non- 0 bit type7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:15: error: '*u0' and '?*u0' do not have the same in-memory representation11// tmp.zig:3:15: error: '*u0' and '?*u0' do not have the same in-memory representation
10// tmp.zig:3:31: note: '*u0' has no in-memory bits12// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 _ = y;4 _ = y;
5}5}
66
7// @ptrCast discards const qualifier7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:15: error: cast discards const qualifier11// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = b;3 _ = b;
4}4}
55
6// @ptrToInt 0 to non optional pointer6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:13: error: pointer type '*i32' does not allow address zero10// 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 {...@@ -2,6 +2,8 @@ export fn entry() bool {
2 return @ptrToInt(&{}) == @ptrToInt(&{});2 return @ptrToInt(&{}) == @ptrToInt(&{});
3}3}
44
5// @ptrToInt on *void5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:23: error: pointer to size 0 type has no address9// 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 {...@@ -2,6 +2,8 @@ export fn entry(a: *i32) usize {
2 return @ptrCast(usize, a);2 return @ptrCast(usize, a);
3}3}
44
5// ptrcast to non-pointer5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:21: error: expected pointer, found 'usize'9// 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 {...@@ -12,6 +12,8 @@ fn foo(x: i32) !void {
12 }12 }
13}13}
1414
15// range operator in switch used on error set15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:3:17: error: operator not allowed for errors19// 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 {...@@ -6,6 +6,8 @@ comptime {
6 _ = deref;6 _ = deref;
7}7}
88
9// reading past end of pointer casted array9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:26: error: attempt to read 4 bytes from [4]u8 at index 1 which is 3 bytes13// 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 {...@@ -5,6 +5,8 @@ fn foo() !void {
5 try foo();5 try foo();
6}6}
77
8// recursive inferred error set8// error
9// backend=stage1
10// target=native
9//11//
10// 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 yet12// 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 @@...@@ -1,7 +1,9 @@
1const A = enum {x};1const A = enum {x};
2const A = enum {x};2const A = enum {x};
33
4// redefinition of enums4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:2:1: error: redeclaration of 'A'8// tmp.zig:2:1: error: redeclaration of 'A'
7// tmp.zig:1:1: note: other declaration here9// tmp.zig:1:1: note: other declaration here
test/compile_errors/stage1/obj/redefinition_of_global_variables.zig+3-1
...@@ -1,7 +1,9 @@...@@ -1,7 +1,9 @@
1var a : i32 = 1;1var a : i32 = 1;
2var a : i32 = 2;2var a : i32 = 2;
33
4// redefinition of global variables4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:2:1: error: redeclaration of 'a'8// tmp.zig:2:1: error: redeclaration of 'a'
7// tmp.zig:1:1: note: other declaration here9// tmp.zig:1:1: note: other declaration here
test/compile_errors/stage1/obj/redefinition_of_struct.zig+3-1
...@@ -1,7 +1,9 @@...@@ -1,7 +1,9 @@
1const A = struct { x : i32, };1const A = struct { x : i32, };
2const A = struct { y : i32, };2const A = struct { y : i32, };
33
4// redefinition of struct4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:2:1: error: redeclaration of 'A'8// tmp.zig:2:1: error: redeclaration of 'A'
7// tmp.zig:1:1: note: other declaration here9// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 f(i32);4 f(i32);
5}5}
66
7// refer to the type of a generic function7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:4:5: error: use of undefined value here causes undefined behavior11// 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 {...@@ -10,6 +10,8 @@ fn assert(ok: bool) void {
10 if (!ok) unreachable;10 if (!ok) unreachable;
11}11}
1212
13// referring to a struct that is invalid13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:10:14: error: reached unreachable code17// 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 {...@@ -14,6 +14,8 @@ export fn entry() void {
14 _ = afoo;14 _ = afoo;
15}15}
1616
17// regression test #2980: base type u32 is not type checked properly when assigning a value within a struct17// error
18// backend=stage1
19// target=native
18//20//
19// 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'21// 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(.{...@@ -10,6 +10,8 @@ const Foo = @Type(.{
10});10});
11comptime { _ = Foo; }11comptime { _ = Foo; }
1212
13// @Type(.Fn) with is_generic = true13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:1:20: error: Type.Fn.is_generic must be false for @Type17// 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(.{...@@ -10,6 +10,8 @@ const Foo = @Type(.{
10});10});
11comptime { _ = Foo; }11comptime { _ = Foo; }
1212
13// @Type(.Fn) with is_var_args = true and non-C callconv13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:1:20: error: varargs functions must have C calling convention17// 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(.{...@@ -10,6 +10,8 @@ const Foo = @Type(.{
10});10});
11comptime { _ = Foo; }11comptime { _ = Foo; }
1212
13// @Type(.Fn) with return_type = null13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:1:20: error: Type.Fn.return_type must be non-null for @Type17// 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 {...@@ -11,6 +11,8 @@ export fn entry() void {
11 }});11 }});
12}12}
1313
14// @Type(.Pointer) with invalid address space 14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:2:16: error: address space 'gs' not available in stage 1 compiler, must be .generic18// 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 {...@@ -11,6 +11,8 @@ export fn entry() void {
11 _ = @intToEnum(Tag, 0);11 _ = @intToEnum(Tag, 0);
12}12}
1313
14// @Type for exhaustive enum with non-integer tag type14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:1:20: error: Type.Enum.tag_type must be an integer type, not 'bool'18// 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 {...@@ -11,6 +11,8 @@ export fn entry() void {
11 _ = @intToEnum(Tag, 0);11 _ = @intToEnum(Tag, 0);
12}12}
1313
14// @Type for exhaustive enum with undefined tag type14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:1:20: error: use of undefined value here causes undefined behavior18// 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 {...@@ -11,6 +11,8 @@ export fn entry() void {
11 _ = @intToEnum(Tag, 0);11 _ = @intToEnum(Tag, 0);
12}12}
1313
14// @Type for exhaustive enum with zero fields14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:1:20: error: enums must have 1 or more fields18// 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 {...@@ -27,6 +27,8 @@ export fn entry() void {
27 tagged = .{ .unsigned = 1 };27 tagged = .{ .unsigned = 1 };
28}28}
2929
30// @Type for tagged union with extra enum field30// error
31// backend=stage1
32// target=native
31//33//
32// tmp.zig:14:23: error: enum field missing: 'arst'34// 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 {...@@ -27,7 +27,9 @@ export fn entry() void {
27 tagged = .{ .unsigned = 1 };27 tagged = .{ .unsigned = 1 };
28}28}
2929
30// @Type for tagged union with extra union field30// error
31// backend=stage1
32// target=native
31//33//
32// tmp.zig:13:23: error: enum field not found: 'arst'34// tmp.zig:13:23: error: enum field not found: 'arst'
33// tmp.zig:1:20: note: enum declared here35// 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 {...@@ -12,6 +12,8 @@ export fn entry() void {
12 _ = Untagged{};12 _ = Untagged{};
13}13}
1414
15// @Type for union with opaque field15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:1:25: error: opaque types have unknown size and therefore cannot be directly embedded in unions19// 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 {...@@ -10,6 +10,8 @@ export fn entry() void {
10 _ = Untagged{};10 _ = Untagged{};
11}11}
1212
13// @Type for union with zero fields13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:1:25: error: unions must have 1 or more fields17// 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(.{...@@ -3,6 +3,8 @@ const Foo = @Type(.{
3});3});
4comptime { _ = Foo; }4comptime { _ = Foo; }
55
6// @Type() union payload is undefined6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:1:20: error: use of undefined value here causes undefined behavior10// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 });6 });
7}7}
88
9// @Type with Type.Int9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:3:31: error: expected type 'std.builtin.Type', found 'std.builtin.Type.Int'13// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 _ = @Type(globalTypeInfo);4 _ = @Type(globalTypeInfo);
5}5}
66
7// @Type with non-constant expression7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:4:15: error: unable to evaluate constant expression11// 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 {...@@ -12,7 +12,9 @@ comptime {
12 });12 });
13}13}
1414
15// @Type with undefined15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:2:16: error: use of undefined value here causes undefined behavior19// tmp.zig:2:16: error: use of undefined value here causes undefined behavior
18// tmp.zig:5:16: error: use of undefined value here causes undefined behavior20// 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 {...@@ -11,6 +11,8 @@ pub const Container = struct {
11 not_optional: i32,11 not_optional: i32,
12};12};
1313
14// result location incompatibility mismatching handle_is_ptr14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:3:36: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'i32', found '?i32'18// 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 {...@@ -11,6 +11,8 @@ pub const Container = struct {
11 not_optional: i32,11 not_optional: i32,
12};12};
1313
14// result location incompatibility mismatching handle_is_ptr (generic call)14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:3:36: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'i32', found '?i32'18// 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 {...@@ -14,6 +14,8 @@ pub fn maybeInt() ?i32 {
1414
15export fn entry() usize { return @sizeOf(@TypeOf(testTrickyDefer)); }15export fn entry() usize { return @sizeOf(@TypeOf(testTrickyDefer)); }
1616
17// return from defer expression17// error
18// backend=stage1
19// target=native
18//20//
19// tmp.zig:4:11: error: 'try' not allowed inside defer expression21// 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 {...@@ -5,6 +5,8 @@ fn amain() callconv(.Async) void {
5 return error.ShouldBeCompileError;5 return error.ShouldBeCompileError;
6}6}
77
8// returning error from void async function8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:5:17: error: expected type 'void', found 'error{ShouldBeCompileError}'12// 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 {...@@ -7,6 +7,8 @@ fn amain() void {
7}7}
8fn afunc() callconv(.Async) void {}8fn afunc() callconv(.Async) void {}
99
10// runtime-known async function called10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:6:12: error: function is not comptime-known; @asyncCall required14// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
55
6fn afunc() callconv(.Async) void { }6fn afunc() callconv(.Async) void { }
77
8// runtime-known function called with async keyword8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:15: error: function is not comptime-known; @asyncCall required12// 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 {...@@ -8,6 +8,8 @@ export fn f() void {
8 _ = foo;8 _ = foo;
9}9}
1010
11// runtime assignment to comptime struct type11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:7:23: error: unable to evaluate constant expression15// 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 {...@@ -8,6 +8,8 @@ export fn f() void {
8 _ = foo;8 _ = foo;
9}9}
1010
11// runtime assignment to comptime union type11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:7:23: error: unable to evaluate constant expression15// 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 {...@@ -12,7 +12,9 @@ fn foo(l: Letter) void {
12 _ = x;12 _ = x;
13}13}
1414
15// runtime cast to union which has non-void fields15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:11:20: error: runtime cast to union 'Value' which has non-void fields19// tmp.zig:11:20: error: runtime cast to union 'Value' which has non-void fields
18// tmp.zig:3:5: note: field 'A' has type 'i32'20// 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 {...@@ -10,6 +10,8 @@ export fn entry() void {
10 _ = field;10 _ = field;
11}11}
1212
13// runtime index into comptime type slice13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:9:51: error: values of type 'std.builtin.Type.StructField' must be comptime known, but index value is runtime known17// 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 {...@@ -2,6 +2,8 @@ export fn a() void {
2 _ = @as(f32, 1.0) +| @as(f32, 1.0);2 _ = @as(f32, 1.0) +| @as(f32, 1.0);
3}3}
44
5// saturating arithmetic does not allow floats5// error
6// backend=stage1
7// target=native
6//8//
7// error: invalid operands to binary expression: 'f32' and 'f32'9// 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 {...@@ -5,6 +5,8 @@ export fn a() void {
5 }5 }
6}6}
77
8// saturating shl assign does not allow negative rhs at comptime8// error
9// backend=stage1
10// target=native
9//11//
10// error: shift by negative value -212// 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 {...@@ -2,6 +2,8 @@ export fn a() void {
2 _ = @as(i32, 1) <<| @as(i32, -2);2 _ = @as(i32, 1) <<| @as(i32, -2);
3}3}
44
5// saturating shl does not allow negative rhs at comptime5// error
6// backend=stage1
7// target=native
6//8//
7// error: shift by negative value -29// 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 {...@@ -5,6 +5,8 @@ fn foo() callconv(.Inline) void {
5 @setAlignStack(16);5 @setAlignStack(16);
6}6}
77
8// @setAlignStack in inline function8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:5:5: error: @setAlignStack in inline function12// 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 {...@@ -2,6 +2,8 @@ export fn entry() callconv(.Naked) void {
2 @setAlignStack(16);2 @setAlignStack(16);
3}3}
44
5// @setAlignStack in naked function5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: @setAlignStack in naked function9// 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 {...@@ -2,6 +2,8 @@ comptime {
2 @setAlignStack(16);2 @setAlignStack(16);
3}3}
44
5// @setAlignStack outside function5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: @setAlignStack outside function9// 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 {...@@ -3,7 +3,9 @@ export fn entry() void {
3 @setAlignStack(16);3 @setAlignStack(16);
4}4}
55
6// @setAlignStack set twice6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: alignstack set twice10// tmp.zig:3:5: error: alignstack set twice
9// tmp.zig:2:5: note: first set here11// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 @setAlignStack(511 + 1);2 @setAlignStack(511 + 1);
3}3}
44
5// @setAlignStack too big5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: attempt to @setAlignStack(512); maximum is 2569// 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 {...@@ -3,7 +3,9 @@ export fn foo() void {
3 @setFloatMode(@import("std").builtin.FloatMode.Optimized);3 @setFloatMode(@import("std").builtin.FloatMode.Optimized);
4}4}
55
6// @setFloatMode twice for same scope6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: float mode set twice for same scope10// tmp.zig:3:5: error: float mode set twice for same scope
9// tmp.zig:2:5: note: first set here11// 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 {...@@ -3,7 +3,9 @@ export fn foo() void {
3 @setRuntimeSafety(false);3 @setRuntimeSafety(false);
4}4}
55
6// @setRuntimeSafety twice for same scope6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: runtime safety set twice for same scope10// tmp.zig:3:5: error: runtime safety set twice for same scope
9// tmp.zig:2:5: note: first set here11// 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 {...@@ -3,6 +3,8 @@ export fn entry() i32 {
3 return foo;3 return foo;
4}4}
55
6// setting a section on a local variable6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:30: error: cannot set section of local variable 'foo'10// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// shift amount has to be an integer type6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:21: error: shift amount has to be an integer type, but found '*const u8'10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a;3 _ = a;
4}4}
55
6// shift by negative comptime integer6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:18: error: shift by negative value -110// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a >>= 2;3 a >>= 2;
4}4}
55
6// shift left assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a << 2;3 _ = a << 2;
4}4}
55
6// shift left on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a >>= 2;3 a >>= 2;
4}4}
55
6// shift right assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a >> 2;3 _ = a >> 2;
4}4}
55
6// shift right on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -2,6 +2,8 @@ export fn entry(x: u8, y: u8) u8 {
2 return x << y;2 return x << y;
3}3}
44
5// shifting RHS is log2 of LHS int bit width5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:17: error: expected type 'u3', found 'u8'9// 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 {...@@ -2,6 +2,8 @@ export fn entry(x: u8) u8 {
2 return 0x11 << x;2 return 0x11 << x;
3}3}
44
5// shifting without int type or comptime known5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be compile-time known9// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = x;3 _ = x;
4}4}
55
6// @shlExact shifts out 1 bits6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: operation caused overflow10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = x;3 _ = x;
4}4}
55
6// @shrExact shifts out 1 bits6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: exact shift shifted out 1 bits10// 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 {...@@ -2,6 +2,8 @@ export fn foo(a: i32, b: i32) i32 {
2 return a / b;2 return a / b;
3}3}
44
5// signed integer division5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact9// 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 {...@@ -2,6 +2,8 @@ export fn foo(a: i32, b: i32) i32 {
2 return a % b;2 return a % b;
3}3}
44
5// signed integer remainder division5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:14: error: remainder division with 'i32' and 'i32': signed integers and floats must use @rem or @mod9// 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 {...@@ -2,6 +2,8 @@ export fn entry() usize {
2 return @sizeOf(@TypeOf(null));2 return @sizeOf(@TypeOf(null));
3}3}
44
5// @sizeOf bad type5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:20: error: no size available for type '@Type(.Null)'9// 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 {...@@ -4,6 +4,8 @@ export fn foo() void {
4 _ = value;4 _ = value;
5}5}
66
7// slice cannot have its bytes reinterpreted7// error
8// backend=stage1
9// target=native
8//10//
9// :3:52: error: slice '[]const u8' cannot have its bytes reinterpreted11// :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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// slice passed as array init type6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: array literal requires address-of operator (&) to coerce to slice type '[]u8'10// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// slice passed as array init type with elems6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: array literal requires address-of operator (&) to coerce to slice type '[]u8'10// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = y;3 _ = y;
4}4}
55
6// slice sentinel mismatch - 16// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:37: error: expected type '[:1]const u8', found '*const [2:2]u8'10// 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 {...@@ -4,7 +4,9 @@ fn foo() [:0]u8 {
4}4}
5comptime { _ = foo; }5comptime { _ = foo; }
66
7// slice sentinel mismatch - 27// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:12: error: expected type '[:0]u8', found '[]u8'11// tmp.zig:3:12: error: expected type '[:0]u8', found '[]u8'
10// tmp.zig:3:12: note: destination pointer requires a terminating '0' sentinel12// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = buf[0..1];3 _ = buf[0..1];
4}4}
55
6// slicing of global undefined pointer6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:12: error: non-zero length slice of undefined pointer10// 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 {...@@ -3,6 +3,8 @@ export fn entry(ptr: *i32) void {
3 _ = slice;3 _ = slice;
4}4}
55
6// slicing single-item pointer6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:22: error: slice of single-item pointer10// 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 {...@@ -11,6 +11,8 @@ export fn entry() void {
11 _ = x;11 _ = x;
12}12}
1313
14// specify enum tag type that is too small14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:6:5: error: enumeration value 4 too large for type 'u2'18// 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 {...@@ -9,6 +9,8 @@ export fn entry() void {
9 _ = x;9 _ = x;
10}10}
1111
12// specify non-integer enum tag type12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:1:21: error: expected integer, found 'f32'16// 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 {...@@ -2,6 +2,8 @@ comptime {
2 @src();2 @src();
3}3}
44
5// @src outside function5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: @src outside function9// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 @import("std").debug.print("{d} {d} {d} {d} {d}", .{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15});2 @import("std").debug.print("{d} {d} {d} {d} {d}", .{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15});
3}3}
44
5// std.fmt error for unused arguments5// error
6// backend=stage1
7// target=native
6//8//
7// ?:?:?: error: 10 unused arguments in '{d} {d} {d} {d} {d}'9// ?:?:?: 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 {...@@ -9,6 +9,8 @@ fn storev(ptr: anytype, val: i32) void {
9 ptr.* = val;9 ptr.* = val;
10}10}
1111
12// store vector pointer with unknown runtime index12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:9:8: error: unable to determine vector element index of type '*align(16:0:4:?) i3216// 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 {...@@ -42,6 +42,8 @@ export fn entry() void {
42 }42 }
43}43}
4444
45// storing runtime value in compile time variable then using it45// error
46// backend=stage1
47// target=native
46//48//
47// tmp.zig:38:29: error: cannot store runtime value in compile time variable49// 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 {...@@ -10,7 +10,9 @@ export fn entry() void {
10 _ = obj;10 _ = obj;
11}11}
1212
13// struct depends on itself via optional field13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:1:17: error: struct 'LhsExpr' depends on itself17// tmp.zig:1:17: error: struct 'LhsExpr' depends on itself
16// tmp.zig:5:5: note: while checking this field18// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 _ = a;6 _ = a;
7}7}
88
9// struct field missing type9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:2:5: error: struct field missing type13// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = foo;3 _ = foo;
4}4}
55
6// struct init syntax for array6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:1:13: error: initializing array with struct syntax10// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 _ = @Type(@typeInfo(struct { const foo = 1; }));2 _ = @Type(@typeInfo(struct { const foo = 1; }));
3}3}
44
5// struct with declarations unavailable for @Type5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:15: error: Type.Struct.decls must be empty for @Type9// 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 {...@@ -23,6 +23,8 @@ export fn entry() void {
23 _ = a;23 _ = a;
24}24}
2525
26// struct with invalid field26// error
27// backend=stage1
28// target=native
27//29//
28// tmp.zig:14:17: error: use of undeclared identifier 'HeaderValue'30// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a -= a;3 a -= a;
4}4}
55
6// sub assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a - a;3 _ = a - a;
4}4}
55
6// sub on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -5,6 +5,8 @@ fn sub(a: u16, b: u16) u16 {
55
6export fn entry() usize { return @sizeOf(@TypeOf(y)); }6export fn entry() usize { return @sizeOf(@TypeOf(y)); }
77
8// sub overflow in function evaluation8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:14: error: operation caused overflow12// 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 {...@@ -3,6 +3,8 @@ comptime {
3 a -%= a;3 a -%= a;
4}4}
55
6// sub wrap assign on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = a -% a;3 _ = a -% a;
4}4}
55
6// sub wrap on undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:9: error: use of undefined value here causes undefined behavior10// 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 {...@@ -8,7 +8,9 @@ fn foo() void {
8 }8 }
9}9}
1010
11// suspend inside suspend block11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:6:9: error: cannot suspend inside suspend block15// tmp.zig:6:9: error: cannot suspend inside suspend block
14// tmp.zig:5:5: note: other suspend block here16// 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 {...@@ -16,7 +16,9 @@ fn f(n: Number) i32 {
1616
17export fn entry() usize { return @sizeOf(@TypeOf(f)); }17export fn entry() usize { return @sizeOf(@TypeOf(f)); }
1818
19// switch expression - duplicate enumeration prong19// error
20// backend=stage1
21// target=native
20//22//
21// tmp.zig:13:15: error: duplicate switch value23// tmp.zig:13:15: error: duplicate switch value
22// tmp.zig:10:15: note: other value here24// 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 {...@@ -17,7 +17,9 @@ fn f(n: Number) i32 {
1717
18export fn entry() usize { return @sizeOf(@TypeOf(f)); }18export fn entry() usize { return @sizeOf(@TypeOf(f)); }
1919
20// switch expression - duplicate enumeration prong when else present20// error
21// backend=stage1
22// target=native
21//23//
22// tmp.zig:13:15: error: duplicate switch value24// tmp.zig:13:15: error: duplicate switch value
23// tmp.zig:10:15: note: other value here25// 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 {...@@ -8,7 +8,9 @@ fn foo(x: u8) u8 {
8}8}
9export fn entry() usize { return @sizeOf(@TypeOf(foo)); }9export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1010
11// switch expression - duplicate or overlapping integer value11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:6:9: error: duplicate switch value15// tmp.zig:6:9: error: duplicate switch value
14// tmp.zig:5:14: note: previous value here16// 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 {...@@ -9,7 +9,9 @@ fn foo(comptime T: type, x: T) u8 {
9}9}
10export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); }10export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); }
1111
12// switch expression - duplicate type12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:6:9: error: duplicate switch value16// tmp.zig:6:9: error: duplicate switch value
15// tmp.zig:4:9: note: previous value here17// 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 {...@@ -13,7 +13,9 @@ fn foo(comptime T: type, x: T) u8 {
13}13}
14export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); }14export 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
17//19//
18// tmp.zig:10:9: error: duplicate switch value20// tmp.zig:10:9: error: duplicate switch value
19// tmp.zig:8:9: note: previous value here21// 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 {...@@ -14,6 +14,8 @@ fn f(n: Number) i32 {
1414
15export fn entry() usize { return @sizeOf(@TypeOf(f)); }15export fn entry() usize { return @sizeOf(@TypeOf(f)); }
1616
17// switch expression - missing enumeration prong17// error
18// backend=stage1
19// target=native
18//20//
19// tmp.zig:8:5: error: enumeration value 'Number.Four' not handled in switch21// 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 {...@@ -9,6 +9,8 @@ export fn entry() void {
9 f(1234);9 f(1234);
10}10}
1111
12// switch expression - multiple else prongs12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:5:9: error: multiple else prongs in switch expression16// 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 {...@@ -5,6 +5,8 @@ fn foo(x: u8) void {
5}5}
6export fn entry() usize { return @sizeOf(@TypeOf(foo)); }6export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
77
8// switch expression - non exhaustive integer prongs8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:2:5: error: switch must handle all possibilities12// 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 {...@@ -6,6 +6,8 @@ fn foo(x: *u8) void {
6const y: u8 = 100;6const y: u8 = 100;
7export fn entry() usize { return @sizeOf(@TypeOf(foo)); }7export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
88
9// switch expression - switch on pointer type with no else9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:2:5: error: else prong required when switching on type '*u8'13// 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 {...@@ -7,6 +7,8 @@ fn foo(x: bool) void {
7}7}
8export fn entry() usize { return @sizeOf(@TypeOf(foo)); }8export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
99
10// switch expression - unreachable else prong (bool)10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:5:9: error: unreachable else prong, all cases already handled14// 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 {...@@ -17,6 +17,8 @@ fn foo(x: u8) void {
1717
18export fn entry() usize { return @sizeOf(@TypeOf(foo)); }18export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1919
20// switch expression - unreachable else prong (enum)20// error
21// backend=stage1
22// target=native
21//23//
22// tmp.zig:14:9: error: unreachable else prong, all cases already handled24// 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 {...@@ -10,6 +10,8 @@ fn foo(x: i8) void {
10}10}
11export fn entry() usize { return @sizeOf(@TypeOf(foo)); }11export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1212
13// switch expression - unreachable else prong (range i8)13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:8:9: error: unreachable else prong, all cases already handled17// 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 {...@@ -10,6 +10,8 @@ fn foo(x: u8) void {
10}10}
11export fn entry() usize { return @sizeOf(@TypeOf(foo)); }11export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1212
13// switch expression - unreachable else prong (range u8)13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:8:9: error: unreachable else prong, all cases already handled17// 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 {...@@ -7,6 +7,8 @@ fn foo(x: u1) void {
7}7}
8export fn entry() usize { return @sizeOf(@TypeOf(foo)); }8export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
99
10// switch expression - unreachable else prong (u1)10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:5:9: error: unreachable else prong, all cases already handled14// 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 {...@@ -9,6 +9,8 @@ fn foo(x: u2) void {
9}9}
10export fn entry() usize { return @sizeOf(@TypeOf(foo)); }10export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
1111
12// switch expression - unreachable else prong (u2)12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:7:9: error: unreachable else prong, all cases already handled16// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 switch (f) {}5 switch (f) {}
6}6}
77
8// switch on enum with 1 field with no prongs8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:5:5: error: enumeration value 'Foo.M' not handled in switch12// 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 {...@@ -14,7 +14,9 @@ fn foo(a: *const Payload) void {
14 }14 }
15}15}
1616
17// switch on union with no attached enum17// error
18// backend=stage1
19// target=native
18//20//
19// tmp.zig:11:14: error: switch on union which has no attached enum21// tmp.zig:11:14: error: switch on union which has no attached enum
20// tmp.zig:1:17: note: consider 'union(enum)' here22// 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 {...@@ -10,6 +10,8 @@ fn Test(comptime T: type) void {
10 _ = x;10 _ = x;
11}11}
1212
13// switch with invalid expression parameter13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:7:17: error: switch on type 'type' provides no expression parameter17// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 }6 }
7}7}
88
9// switch with overlapping case ranges9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:9: error: duplicate switch value13// 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 {...@@ -8,7 +8,9 @@ export fn entry() void {
8 _ = tagName;8 _ = tagName;
9}9}
1010
11// @tagName used on union with no associated enum tag11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:7:19: error: union has no associated enum15// tmp.zig:7:19: error: union has no associated enum
14// tmp.zig:1:18: note: declared here16// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// take slice of invalid dereference6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:18: error: attempt to dereference non-pointer type 'comptime_int'10// 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 {...@@ -6,6 +6,8 @@ export fn foo() void {
6 _ = fieldOffset;6 _ = fieldOffset;
7}7}
88
9// taking bit offset of void field in struct9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:45: error: zero-bit field 'val' in struct 'Empty' has no offset13// 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 {...@@ -6,6 +6,8 @@ export fn foo() void {
6 _ = fieldOffset;6 _ = fieldOffset;
7}7}
88
9// taking byte offset of void field in struct9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:5:42: error: zero-bit field 'val' in struct 'Empty' has no offset13// 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 {...@@ -3,6 +3,8 @@ export fn entry() i32 {
3 return x;3 return x;
4}4}
55
6// threadlocal qualifier on const6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:1:1: error: threadlocal variable cannot be constant10// 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 {...@@ -5,6 +5,8 @@ export fn entry() void {
5 _ = c;5 _ = c;
6}6}
77
8// top level decl dependency loop8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:2:19: error: dependency loop detected12// 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 {...@@ -15,7 +15,9 @@ export fn entry4() u8 {
15 return @truncate(u8, x);15 return @truncate(u8, x);
16}16}
1717
18// truncate sign mismatch18// error
19// backend=stage1
20// target=native
19//21//
20// tmp.zig:3:26: error: expected signed integer type, found 'u32'22// tmp.zig:3:26: error: expected signed integer type, found 'u32'
21// tmp.zig:7:26: error: expected unsigned integer type, found 'i32'23// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = z;3 _ = z;
4}4}
55
6// @truncate undefined value6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:27: error: use of undefined value here causes undefined behavior10// 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 {...@@ -3,6 +3,8 @@ export fn f() void {
3}3}
4fn something() anyerror!void { }4fn something() anyerror!void { }
55
6// try in function with non error return type6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:5: error: expected type 'void', found 'anyerror'10// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 a(c);6 a(c);
7}7}
88
9// type checking function pointers9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:6:7: error: expected type 'fn(*const u8) void', found 'fn(u8) void'13// 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 {...@@ -3,6 +3,8 @@ export fn entry() foo {
3 return 1;3 return 1;
4}4}
55
6// type variables must be constant6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:1:1: error: variable of type 'type' must be constant10// 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 {...@@ -4,6 +4,8 @@ export fn a() void {
4 c;4 c;
5}5}
66
7// undeclared identifier7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:5: error: use of undeclared identifier 'b'11// 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 {...@@ -5,6 +5,8 @@ fn test_a_thing() void {
5 bad_fn_call();5 bad_fn_call();
6}6}
77
8// undeclared identifier error should mark fn as impure8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:5:5: error: use of undeclared identifier 'bad_fn_call'12// 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 {...@@ -4,6 +4,8 @@ export fn a() void {
4 }4 }
5}5}
66
7// undeclared identifier in unanalyzed branch7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:9: error: use of undeclared identifier 'lol_this_doesnt_exist'11// 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 {...@@ -6,6 +6,8 @@ export fn entry1() void {
6 _ = foo;6 _ = foo;
7}7}
88
9// undefined as field type is rejected9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:2:8: error: use of undefined value here causes undefined behavior13// 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 {...@@ -2,6 +2,8 @@ export fn a() void {
2 b();2 b();
3}3}
44
5// undefined function call5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: use of undeclared identifier 'b'9// 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 {...@@ -3,6 +3,8 @@ export fn f1() usize {
3 return _;3 return _;
4}4}
55
6// `_` is not a declarable symbol6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:9: error: '_' used as an identifier without @"_" syntax10// 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 {...@@ -6,6 +6,8 @@ export fn returns() void {
6 }6 }
7}7}
88
9// `_` should not be usable inside for9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:4:20: error: '_' used as an identifier without @"_" syntax13// 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 {...@@ -9,6 +9,8 @@ fn optionalReturn() ?u32 {
9 return 1;9 return 1;
10}10}
1111
12// `_` should not be usable inside while12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:4:20: error: '_' used as an identifier without @"_" syntax16// 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 {...@@ -11,6 +11,8 @@ fn optionalReturnError() !?u32 {
11 return error.optionalReturnError;11 return error.optionalReturnError;
12}12}
1313
14// `_` should not be usable inside while else14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:6:17: error: '_' used as an identifier without @"_" syntax18// 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 {...@@ -10,7 +10,9 @@ export fn entry() void {
10 _ = x;10 _ = x;
11}11}
1212
13// union auto-enum value already taken13// error
14// backend=stage1
15// target=native
14//16//
15// tmp.zig:6:9: error: enum tag value 60 already taken17// tmp.zig:6:9: error: enum tag value 60 already taken
16// tmp.zig:4:9: note: other occurrence here18// 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 {...@@ -14,7 +14,9 @@ export fn entry() void {
14 _ = a;14 _ = a;
15}15}
1616
17// union enum field does not match enum17// error
18// backend=stage1
19// target=native
18//20//
19// tmp.zig:10:5: error: enum field not found: 'D'21// tmp.zig:10:5: error: enum field not found: 'D'
20// tmp.zig:1:16: note: enum declared here22// 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 {...@@ -6,7 +6,9 @@ export fn entry() void {
6 _ = x;6 _ = x;
7}7}
88
9// union fields with value assignments9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:1:24: error: explicitly valued tagged union missing integer tag type13// tmp.zig:1:24: error: explicitly valued tagged union missing integer tag type
12// tmp.zig:2:14: note: tag value specified here14// 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 @@...@@ -1,5 +1,7 @@
1const Foo = union {};1const Foo = union {};
22
3// union with 0 fields3// error
4// backend=stage1
5// target=native
4//6//
5// tmp.zig:1:13: error: union declarations must have at least one tag7// 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 {...@@ -11,7 +11,9 @@ export fn entry() usize {
11 return @sizeOf(Payload);11 return @sizeOf(Payload);
12}12}
1313
14// union with specified enum omits field14// error
15// backend=stage1
16// target=native
15//17//
16// tmp.zig:6:17: error: enum field missing: 'C'18// tmp.zig:6:17: error: enum field missing: 'C'
17// tmp.zig:4:5: note: declared here19// 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 {...@@ -8,7 +8,9 @@ export fn entry() void {
8 _ = U{ .D = 1 };8 _ = U{ .D = 1 };
9}9}
1010
11// union with too small explicit signed tag type11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:1:22: error: specified integer tag type cannot represent every field15// tmp.zig:1:22: error: specified integer tag type cannot represent every field
14// tmp.zig:1:22: note: type i2 cannot fit values in range 0...316// 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 {...@@ -9,7 +9,9 @@ export fn entry() void {
9 _ = U{ .E = 1 };9 _ = U{ .E = 1 };
10}10}
1111
12// union with too small explicit unsigned tag type12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:1:22: error: specified integer tag type cannot represent every field16// tmp.zig:1:22: error: specified integer tag type cannot represent every field
15// tmp.zig:1:22: note: type u2 cannot fit values in range 0...417// 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 @@...@@ -1,5 +1,7 @@
1export const T = [*]opaque {};1export const T = [*]opaque {};
22
3// unknown length pointer to opaque3// error
4// backend=stage1
5// target=native
4//6//
5// tmp.zig:1:21: error: unknown-length pointer to opaque7// 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 {...@@ -4,7 +4,9 @@ export fn a() void {
4 };4 };
5}5}
66
7// unreachable code - double break7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:9: error: unreachable code11// tmp.zig:3:9: error: unreachable code
10// tmp.zig:3:20: note: control flow is diverted here12// 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 {...@@ -2,7 +2,9 @@ export fn a() i32 {
2 return return 1;2 return return 1;
3}3}
44
5// unreachable code - nested returns5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: unreachable code9// tmp.zig:2:5: error: unreachable code
8// tmp.zig:2:12: note: control flow is diverted here10// 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 {...@@ -5,7 +5,9 @@ export fn a() void {
55
6fn b() void {}6fn b() void {}
77
8// unreachable code8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:3:6: error: unreachable code12// tmp.zig:3:6: error: unreachable code
11// tmp.zig:2:5: note: control flow is diverted here13// 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 {...@@ -8,7 +8,9 @@ export fn entry() void {
8 _ = foo(-42);8 _ = foo(-42);
9}9}
1010
11// unreachable executed at comptime11// error
12// backend=stage1
13// target=native
12//14//
13// tmp.zig:4:9: error: reached unreachable code15// tmp.zig:4:9: error: reached unreachable code
14// tmp.zig:8:12: note: called from here16// tmp.zig:8:12: note: called from here
test/compile_errors/stage1/obj/unreachable_parameter.zig+3-1
...@@ -1,6 +1,8 @@...@@ -1,6 +1,8 @@
1fn f(a: noreturn) void { _ = a; }1fn f(a: noreturn) void { _ = a; }
2export fn entry() void { f(); }2export fn entry() void { f(); }
33
4// unreachable parameter4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:9: error: parameter of type 'noreturn' not allowed8// 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 {...@@ -3,6 +3,8 @@ export fn f() void {
3 _ = a;3 _ = a;
4}4}
55
6// unreachable variable6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:25: error: expected type 'noreturn', found 'void'10// 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 @@...@@ -1,6 +1,8 @@
1fn a() noreturn {return;}1fn a() noreturn {return;}
2export fn entry() void { a(); }2export fn entry() void { a(); }
33
4// unreachable with return4// error
5// backend=stage1
6// target=native
5//7//
6// tmp.zig:1:18: error: expected type 'noreturn', found 'void'8// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3 asm volatile ("" : [baz]"+r"(bar) : : "");3 asm volatile ("" : [baz]"+r"(bar) : : "");
4}4}
55
6// unsupported modifier at start of asm output constraint6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:5: error: invalid modifier starting output constraint for 'baz': '+', only '=' is supported. Compiler TODO: see https://github.com/ziglang/zig/issues/21510// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 foo() catch unreachable;6 foo() catch unreachable;
7}7}
88
9// unused variable error on errdefer9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:2:15: error: unused variable: 'a'13// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = a;3 _ = a;
4}4}
55
6// use anyopaque as return type of fn ptr6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:20: error: return type cannot be opaque10// 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 {...@@ -7,6 +7,8 @@ export fn entry() void {
7 _ = y;7 _ = y;
8}8}
99
10// use implicit casts to assign null to non-nullable pointer10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:4:23: error: expected type '*?*i32', found '**i32'14// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 _ = arr;4 _ = arr;
5}5}
66
7// use invalid number literal as array index7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:1:1: error: unable to infer variable type11// 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 {...@@ -6,6 +6,8 @@ export fn entry() void {
6 command.exec();6 command.exec();
7}7}
88
9// use of comptime-known undefined function value9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:6:12: error: use of undefined value here causes undefined behavior13// 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 {...@@ -2,6 +2,8 @@ export fn f() void {
2 b = 3;2 b = 3;
3}3}
44
5// use of undeclared identifier5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: use of undeclared identifier 'b'9// 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 {...@@ -6,6 +6,8 @@ comptime {
6 _ = resolutions;6 _ = resolutions;
7}7}
88
9// using an unknown len ptr type instead of array9// error
10// backend=stage1
11// target=native
10//12//
11// tmp.zig:1:21: error: expected array type or [_], found '[*][*]const u8'13// 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 {...@@ -4,6 +4,8 @@ export fn entry() void {
4 func(MenuEffect.ThisDoesNotExist);4 func(MenuEffect.ThisDoesNotExist);
5}5}
66
7// using invalid types in function call raises an error7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:1:20: error: enum declarations must have at least one tag11// 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 @@...@@ -1,5 +1,7 @@
1usingnamespace void;1usingnamespace void;
22
3// usingnamespace with wrong type3// error
4// backend=stage1
5// target=native
4//6//
5// tmp.zig:1:1: error: expected struct, enum, or union; found 'void'7// 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 {...@@ -3,6 +3,8 @@ export fn f() i32 {
3 return a;3 return a;
4}4}
55
6// variable has wrong type6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:12: error: expected type 'i32', found '*const [1:0]u8'10// 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 {...@@ -12,6 +12,8 @@ export fn entry() void {
12 _ = S;12 _ = S;
13}13}
1414
15// variable initialization compile error then referenced15// error
16// backend=stage1
17// target=native
16//18//
17// tmp.zig:2:12: error: use of undeclared identifier 'T'19// 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 {...@@ -2,7 +2,9 @@ export fn entry9() void {
2 var z: noreturn = return;2 var z: noreturn = return;
3}3}
44
5// variable with type 'noreturn'5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:5: error: unreachable code9// tmp.zig:2:5: error: unreachable code
8// tmp.zig:2:23: note: control flow is diverted here10// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 _ = x;3 _ = x;
4}4}
55
6// vector index out of bounds6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:62: error: index 3 outside vector of size 310// 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 {...@@ -2,6 +2,8 @@ comptime {
2 asm volatile ("");2 asm volatile ("");
3}3}
44
5// volatile on global assembly5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:9: error: volatile is meaningless on global assembly9// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3 return;3 return;
4}4}
55
6// wasmMemoryGrow is a compile error in non-Wasm targets6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:9: error: @wasmMemoryGrow is a wasm32 feature only10// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3 return;3 return;
4}4}
55
6// wasmMemorySize is a compile error in non-Wasm targets6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:9: error: @wasmMemorySize is a wasm32 feature only10// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3}3}
4fn bar() anyerror!i32 { return 1; }4fn bar() anyerror!i32 { return 1; }
55
6// while expected bool, got error union6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: expected type 'bool', found 'anyerror!i32'10// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3}3}
4fn bar() ?i32 { return 1; }4fn bar() ?i32 { return 1; }
55
6// while expected bool, got optional6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: expected type 'bool', found '?i32'10// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3}3}
4fn bar() bool { return true; }4fn bar() bool { return true; }
55
6// while expected error union, got bool6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: expected error union type, found 'bool'10// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3}3}
4fn bar() ?i32 { return 1; }4fn bar() ?i32 { return 1; }
55
6// while expected error union, got optional6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: expected error union type, found '?i32'10// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3}3}
4fn bar() bool { return true; }4fn bar() bool { return true; }
55
6// while expected optional, got bool6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: expected optional type, found 'bool'10// 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 {...@@ -3,6 +3,8 @@ export fn foo() void {
3}3}
4fn bar() anyerror!i32 { return 1; }4fn bar() anyerror!i32 { return 1; }
55
6// while expected optional, got error union6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:15: error: expected optional type, found 'anyerror!i32'10// 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 {...@@ -13,7 +13,9 @@ export fn f3() void {
13 while (x) |_| returns() else |_| unreachable;13 while (x) |_| returns() else |_| unreachable;
14}14}
1515
16// while loop body expression ignored16// error
17// backend=stage1
18// target=native
17//19//
18// tmp.zig:5:25: error: expression value is ignored20// tmp.zig:5:25: error: expression value is ignored
19// tmp.zig:9:26: error: expression value is ignored21// 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 {...@@ -4,6 +4,8 @@ fn f() void {
4}4}
5export fn entry() void { f(); }5export fn entry() void { f(); }
66
7// write to const global variable7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:3:9: error: cannot assign to constant11// 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 {...@@ -9,6 +9,8 @@ fn bar() void {
9 suspend {}9 suspend {}
10}10}
1111
12// wrong frame type used for async call12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:3:13: error: expected type '*@Frame(bar)', found '*@Frame(foo)'16// 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;}...@@ -4,6 +4,8 @@ fn b() i32 {return 1;}
4fn c() i32 {return 2;}4fn c() i32 {return 2;}
5export fn entry() usize { return @sizeOf(@TypeOf(fns)); }5export fn entry() usize { return @sizeOf(@TypeOf(fns)); }
66
7// wrong function type7// error
8// backend=stage1
9// target=native
8//10//
9// tmp.zig:1:28: error: expected type 'fn() void', found 'fn() i32'11// 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 {...@@ -9,6 +9,8 @@ export fn entry() void {
9 v.u.A = U{ .A = i32 };9 v.u.A = U{ .A = i32 };
10}10}
1111
12// wrong initializer for union payload of type 'type'12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:9:8: error: use of undefined value here causes undefined behavior16// 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 {...@@ -3,6 +3,8 @@ export fn a() void {
3}3}
4fn c(d: i32, e: i32, f: i32) void { _ = d; _ = e; _ = f; }4fn c(d: i32, e: i32, f: i32) void { _ = d; _ = e; _ = f; }
55
6// wrong number of arguments6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:6: error: expected 3 argument(s), found 110// 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 {...@@ -7,6 +7,8 @@ fn f(foo: *const Foo) void {
7}7}
8export fn entry() usize { return @sizeOf(@TypeOf(f)); }8export fn entry() usize { return @sizeOf(@TypeOf(f)); }
99
10// wrong number of arguments for method fn call10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:6:15: error: expected 2 argument(s), found 314// 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)...@@ -4,7 +4,9 @@ pub fn panic(comptime msg: []const u8, error_return_trace: ?*builtin.StackTrace)
4}4}
5const builtin = @import("std").builtin;5const builtin = @import("std").builtin;
66
7// wrong panic signature, generic function7// error
8// backend=stage1
9// target=native
8//10//
9// error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype'11// error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype'
10// note: only one of the functions is generic12// 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 "" {}...@@ -3,6 +3,8 @@ test "" {}
3pub fn panic() void {}3pub fn panic() void {}
44
55
6// wrong panic signature, runtime function6// error
7// backend=stage1
8// target=native
7//9//
8// error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn() void'10// 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 {...@@ -5,6 +5,8 @@ export fn foo() void {
5 bar(@ptrCast(*anyopaque, &x));5 bar(@ptrCast(*anyopaque, &x));
6}6}
77
8// wrong pointer coerced to pointer to opaque {}8// error
9// backend=stage1
10// target=native
9//11//
10// tmp.zig:5:9: error: expected type '*Derp', found '*anyopaque'12// 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 @@...@@ -1,5 +1,7 @@
1pub fn main() f32 { }1pub fn main() f32 { }
22
3// wrong return type for main3// error
4// backend=stage1
5// target=native
4//6//
5// error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'7// 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 {...@@ -3,6 +3,8 @@ comptime {
3 _ = array;3 _ = array;
4}4}
55
6// wrong size to an array literal6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:2:31: error: index 2 outside array of size 210// 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 {...@@ -7,6 +7,8 @@ fn foo() i32 {
7 return 0;7 return 0;
8}8}
99
10// wrong type for argument tuple to @asyncCall10// error
11// backend=stage1
12// target=native
11//13//
12// tmp.zig:3:33: error: expected tuple or struct, found 'void'14// 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 {...@@ -2,6 +2,8 @@ export fn entry() void {
2 _ = @Type(0);2 _ = @Type(0);
3}3}
44
5// wrong type for @Type5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:15: error: expected type 'std.builtin.Type', found 'comptime_int'9// 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 {...@@ -9,6 +9,8 @@ fn foo() i32 {
9 return 1234;9 return 1234;
10}10}
1111
12// wrong type for result ptr to @asyncCall12// error
13// backend=stage1
14// target=native
13//15//
14// tmp.zig:6:37: error: expected type '*i32', found 'bool'16// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 @panic(e);3 @panic(e);
4}4}
55
6// wrong type passed to @panic6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:12: error: expected type '[]const u8', found 'error{Foo}'10// 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 {...@@ -2,6 +2,8 @@ export fn entry() bool {
2 return @hasField(i32, "hi");2 return @hasField(i32, "hi");
3}3}
44
5// wrong type to @hasField5// error
6// backend=stage1
7// target=native
6//8//
7// tmp.zig:2:22: error: type 'i32' does not support @hasField9// 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 {...@@ -3,6 +3,8 @@ export fn entry() void {
3 while (!@cmpxchgWeak(i32, &x, 1234, 5678, @as(u32, 1234), @as(u32, 1234))) {}3 while (!@cmpxchgWeak(i32, &x, 1234, 5678, @as(u32, 1234), @as(u32, 1234))) {}
4}4}
55
6// wrong types given to atomic order args in cmpxchg6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:47: error: expected type 'std.builtin.AtomicOrder', found 'u32'10// 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 {...@@ -3,6 +3,8 @@ comptime {
3 @export(entry, .{.name = "entry", .linkage = @as(u32, 1234) });3 @export(entry, .{.name = "entry", .linkage = @as(u32, 1234) });
4}4}
55
6// wrong types given to @export6// error
7// backend=stage1
8// target=native
7//9//
8// tmp.zig:3:59: error: expected type 'std.builtin.GlobalLinkage', found 'comptime_int'10// 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" {...@@ -3,6 +3,9 @@ test "Crash" {
3 _ = @typeInfo(@This()).Struct.decls[0];3 _ = @typeInfo(@This()).Struct.decls[0];
4}4}
55
6// access invalid @typeInfo decl6// error
7// backend=stage1
8// target=native
9// is_test=1
7//10//
8// tmp.zig:1:11: error: use of undeclared identifier 'B'11// 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 {...@@ -17,7 +17,10 @@ export fn qux() void {
17 _ = @alignCast(2, a);17 _ = @alignCast(2, a);
18}18}
1919
20// @alignCast of zero sized types20// error
21// backend=stage1
22// target=native
23// is_test=1
21//24//
22// tmp.zig:3:23: error: cannot adjust alignment of zero sized type '*void'25// tmp.zig:3:23: error: cannot adjust alignment of zero sized type '*void'
23// tmp.zig:7:23: error: cannot adjust alignment of zero sized type '?*void'26// 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 {...@@ -4,6 +4,9 @@ export fn entry() void {
4 _ = v;4 _ = v;
5}5}
66
7// bad @splat type7// error
8// backend=stage1
9// target=native
10// is_test=1
8//11//
9// tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; 'comptime_int' is invalid12// 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 {...@@ -5,6 +5,9 @@ export fn entry() void {
5 _ = x;5 _ = x;
6}6}
77
8// binary OR operator on error sets8// error
9// backend=stage1
10// target=native
11// is_test=1
9//12//
10// tmp.zig:2:18: error: invalid operands to binary expression: 'error{A}' and 'error{B}'13// 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 {...@@ -3,6 +3,9 @@ pub export fn entry() void {
3 @call(.{ .modifier = .always_inline }, call_me, .{});3 @call(.{ .modifier = .always_inline }, call_me, .{});
4}4}
55
6// @call rejects non comptime-known fn - always_inline6// error
7// backend=stage1
8// target=native
9// is_test=1
7//10//
8// tmp.zig:3:5: error: the specified modifier requires a comptime-known function11// 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 {...@@ -3,6 +3,9 @@ pub export fn entry() void {
3 @call(.{ .modifier = .compile_time }, call_me, .{});3 @call(.{ .modifier = .compile_time }, call_me, .{});
4}4}
55
6// @call rejects non comptime-known fn - compile_time6// error
7// backend=stage1
8// target=native
9// is_test=1
7//10//
8// tmp.zig:3:5: error: the specified modifier requires a comptime-known function11// 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 {...@@ -6,7 +6,10 @@ export fn entry() void {
6 a = b;6 a = b;
7}7}
88
9// cast between ?T where T is not a pointer9// error
10// backend=stage1
11// target=native
12// is_test=1
10//13//
11// tmp.zig:6:9: error: expected type '?fn(i8) void', found '?fn(u64) void'14// tmp.zig:6:9: error: expected type '?fn(i8) void', found '?fn(u64) void'
12// tmp.zig:6:9: note: optional type child 'fn(u64) void' cannot cast into optional type child 'fn(i8) void'15// 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 {...@@ -7,7 +7,10 @@ export fn entry() void {
7}7}
8fn foo() void {}8fn foo() void {}
99
10// combination of nosuspend and async10// error
11// backend=stage1
12// target=native
13// is_test=1
11//14//
12// tmp.zig:4:9: error: suspend inside nosuspend block15// tmp.zig:4:9: error: suspend inside nosuspend block
13// tmp.zig:2:5: note: nosuspend block here16// 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 {...@@ -5,7 +5,10 @@ export fn entry() void {
5 _ = ok;5 _ = ok;
6}6}
77
8// comparison of non-tagged union and enum literal8// error
9// backend=stage1
10// target=native
11// is_test=1
9//12//
10// tmp.zig:4:16: error: comparison of union and enum literal is only valid for tagged union types13// tmp.zig:4:16: error: comparison of union and enum literal is only valid for tagged union types
11// tmp.zig:2:15: note: type U is not a tagged union14// 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 {...@@ -5,7 +5,10 @@ comptime {
5 _ = x;5 _ = x;
6}6}
77
8// comptime vector overflow shows the index8// error
9// backend=stage1
10// target=native
11// is_test=1
9//12//
10// tmp.zig:4:15: error: operation caused overflow13// tmp.zig:4:15: error: operation caused overflow
11// tmp.zig:4:15: note: when computing vector element at index 214// 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 {...@@ -10,7 +10,10 @@ export fn entry() void {
10 _ = anon;10 _ = anon;
11}11}
1212
13// duplicate field in anonymous struct literal13// error
14// backend=stage1
15// target=native
16// is_test=1
14//17//
15// tmp.zig:7:13: error: duplicate field18// tmp.zig:7:13: error: duplicate field
16// tmp.zig:4:13: note: other field here19// 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 {...@@ -7,6 +7,9 @@ pub export fn entry() void {
7 _ = a;7 _ = a;
8}8}
99
10// error in struct initializer doesn't crash the compiler10// error
11// backend=stage1
12// target=native
13// is_test=1
11//14//
12// tmp.zig:4:9: error: duplicate struct field: 'e'15// 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 {...@@ -3,6 +3,9 @@ pub export fn entry() void {
3 for (arr) |bits| _ = @popCount(bits);3 for (arr) |bits| _ = @popCount(bits);
4}4}
55
6// errors in for loop bodies are propagated6// error
7// backend=stage1
8// target=native
9// is_test=1
7//10//
8// tmp.zig:3:26: error: expected 2 arguments, found 111// 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 {...@@ -3,6 +3,9 @@ comptime {
3 @export(entry, .{ .name = "" });3 @export(entry, .{ .name = "" });
4}4}
55
6// @export with empty name string6// error
7// backend=stage1
8// target=native
9// is_test=1
7//10//
8// tmp.zig:3:5: error: exported symbol name cannot be empty11// 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 {...@@ -15,7 +15,10 @@ export fn quux() u32 {
15 buf = bar();15 buf = bar();
16}16}
1717
18// helpful return type error message18// error
19// backend=stage1
20// target=native
21// is_test=1
19//22//
20// tmp.zig:2:17: error: expected type 'u32', found 'error{Ohno}'23// tmp.zig:2:17: error: expected type 'u32', found 'error{Ohno}'
21// tmp.zig:1:17: note: function cannot return an error24// 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 {...@@ -7,7 +7,10 @@ export fn bar() void {
7 _ = @intToFloat(comptime_float, a);7 _ = @intToFloat(comptime_float, a);
8}8}
99
10// int/float conversion to comptime_int/float10// error
11// backend=stage1
12// target=native
13// is_test=1
11//14//
12// tmp.zig:3:35: error: unable to evaluate constant expression15// tmp.zig:3:35: error: unable to evaluate constant expression
13// tmp.zig:7:37: error: unable to evaluate constant expression16// 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 {...@@ -10,7 +10,10 @@ export fn entry4() void {
10 2 + 2 = 3;10 2 + 2 = 3;
11}11}
1212
13// invalid assignments13// error
14// backend=stage1
15// target=native
16// is_test=1
14//17//
15// tmp.zig:3:6: error: invalid left-hand side to assignment18// tmp.zig:3:6: error: invalid left-hand side to assignment
16// tmp.zig:7:7: error: invalid left-hand side to assignment19// 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 {...@@ -15,7 +15,10 @@ export fn qux() void {
15 _ = @floatCast(f32, a);15 _ = @floatCast(f32, a);
16}16}
1717
18// invalid float casts18// error
19// backend=stage1
20// target=native
21// is_test=1
19//22//
20// tmp.zig:3:36: error: unable to evaluate constant expression23// tmp.zig:3:36: error: unable to evaluate constant expression
21// tmp.zig:7:21: error: expected integer type, found 'f32'24// 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 {...@@ -15,7 +15,10 @@ export fn qux() void {
15 _ = @intCast(u32, a);15 _ = @intCast(u32, a);
16}16}
1717
18// invalid int casts18// error
19// backend=stage1
20// target=native
21// is_test=1
19//22//
20// tmp.zig:3:32: error: unable to evaluate constant expression23// tmp.zig:3:32: error: unable to evaluate constant expression
21// tmp.zig:7:21: error: expected float type, found 'u32'24// 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 {...@@ -18,7 +18,10 @@ export fn bar() void {
18 _ = u;18 _ = u;
19}19}
2020
21// invalid non-exhaustive enum to union21// error
22// backend=stage1
23// target=native
24// is_test=1
22//25//
23// tmp.zig:12:16: error: runtime cast to union 'U' from non-exhaustive enum26// tmp.zig:12:16: error: runtime cast to union 'U' from non-exhaustive enum
24// tmp.zig:17:16: error: no tag by value 1527// 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 {...@@ -11,6 +11,9 @@ export fn entry() void {
11 }});11 }});
12}12}
1313
14// invalid pointer with @Type14// error
15// backend=stage1
16// target=native
17// is_test=1
15//18//
16// tmp.zig:2:16: error: sentinels are only allowed on slices and unknown-length pointers19// 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 {...@@ -5,6 +5,9 @@ export fn entry() void {
5 _ = v;5 _ = v;
6}6}
77
8// nested vectors8// error
9// backend=stage1
10// target=native
11// is_test=1
9//12//
10// tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid13// 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 {...@@ -10,7 +10,10 @@ const B = enum {
10};10};
11comptime { _ = A; _ = B; }11comptime { _ = A; _ = B; }
1212
13// non-exhaustive enum marker assigned a value13// error
14// backend=stage1
15// target=native
16// is_test=1
14//17//
15// tmp.zig:4:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value18// tmp.zig:4:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value
16// tmp.zig:6:11: error: non-exhaustive enum missing integer tag type19// 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 {...@@ -13,7 +13,10 @@ pub export fn entry() void {
13 _ = C;13 _ = C;
14}14}
1515
16// non-exhaustive enums16// error
17// backend=stage1
18// target=native
19// is_test=1
17//20//
18// tmp.zig:3:5: error: '_' field of non-exhaustive enum must be last21// tmp.zig:3:5: error: '_' field of non-exhaustive enum must be last
19// tmp.zig:6:11: error: non-exhaustive enum specifies every value22// 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) {...@@ -12,6 +12,9 @@ const Error = union(enum) {
12const InvalidToken = struct {};12const InvalidToken = struct {};
13const ExpectedVarDeclOrFn = struct {};13const ExpectedVarDeclOrFn = struct {};
1414
15// not an enum type15// error
16// backend=stage1
17// target=native
18// is_test=1
16//19//
17// tmp.zig:4:9: error: expected type '@typeInfo(Error).Union.tag_type.?', found 'type'20// 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 {...@@ -59,7 +59,10 @@ const Enum = enum {
59 B,59 B,
60};60};
6161
62// packed struct with fields of not allowed types62// error
63// backend=stage1
64// target=native
65// is_test=1
63//66//
64// tmp.zig:2:5: error: type 'anyerror' not allowed in packed struct; no guaranteed in-memory representation67// tmp.zig:2:5: error: type 'anyerror' not allowed in packed struct; no guaranteed in-memory representation
65// 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)68// 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 {...@@ -4,6 +4,9 @@ export fn entry() void {
4 _ = x;4 _ = x;
5}5}
66
7// @ptrToInt with pointer to zero-sized type7// error
8// backend=stage1
9// target=native
10// is_test=1
8//11//
9// tmp.zig:3:23: error: pointer to size 0 type has no address12// 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 {...@@ -5,6 +5,9 @@ export fn entry() void {
5 reassign(.{1, 2, 3});5 reassign(.{1, 2, 3});
6}6}
77
8// reassign to array parameter8// error
9// backend=stage1
10// target=native
11// is_test=1
9//12//
10// tmp.zig:2:15: error: cannot assign to constant13// 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 {...@@ -5,6 +5,9 @@ export fn entry() void {
5 reassign("foo");5 reassign("foo");
6}6}
77
8// reassign to slice parameter8// error
9// backend=stage1
10// target=native
11// is_test=1
9//12//
10// tmp.zig:2:10: error: cannot assign to constant13// 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 {...@@ -8,6 +8,9 @@ export fn entry() void {
8 reassign(S{.x = 3});8 reassign(S{.x = 3});
9}9}
1010
11// reassign to struct parameter11// error
12// backend=stage1
13// target=native
14// is_test=1
12//15//
13// tmp.zig:5:10: error: cannot assign to constant16// 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 {...@@ -19,7 +19,10 @@ export fn qux() void {
19 ptr.x = 2;19 ptr.x = 2;
20}20}
2121
22// reference to const data22// error
23// backend=stage1
24// target=native
25// is_test=1
23//26//
24// tmp.zig:3:14: error: cannot assign to constant27// tmp.zig:3:14: error: cannot assign to constant
25// tmp.zig:7:13: error: cannot assign to constant28// 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 {...@@ -4,6 +4,9 @@ export fn entry() void {
4 _ = @TypeOf(var_1, var_2);4 _ = @TypeOf(var_1, var_2);
5}5}
66
7// @TypeOf with incompatible arguments7// error
8// backend=stage1
9// target=native
10// is_test=1
8//11//
9// tmp.zig:4:9: error: incompatible types: 'f32' and 'u32'12// 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 {...@@ -2,6 +2,9 @@ export fn entry() void {
2 _ = @TypeOf();2 _ = @TypeOf();
3}3}
44
5// @TypeOf with no arguments5// error
6// backend=stage1
7// target=native
8// is_test=1
6//9//
7// tmp.zig:2:9: error: expected at least 1 argument, found 010// 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 {...@@ -2,6 +2,9 @@ extern "c" fn definitelyNotInLibC(a: i32, b: i32) i32 {
2 return a + b;2 return a + b;
3}3}
44
5// reject extern function definitions with body5// error
6// backend=stage1
7// target=native
8// is_test=1
6//9//
7// tmp.zig:1:1: error: extern functions have no body10// 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 @@...@@ -1,5 +1,8 @@
1extern var foo: int = 2;1extern var foo: int = 2;
22
3// reject extern variables with initializers3// error
4// backend=stage1
5// target=native
6// is_test=1
4//7//
5// tmp.zig:1:23: error: extern variables have no initializers8// 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" {...@@ -6,6 +6,9 @@ test "1" {
6 _ = A().a;6 _ = A().a;
7}7}
88
9// repeated invalid field access to generic function returning type crashes compiler. #26559// error
10// backend=stage1
11// target=native
12// is_test=1
10//13//
11// tmp.zig:2:12: error: use of undeclared identifier 'Q'14// 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 @@...@@ -1,5 +1,8 @@
1test "example" { return 1; }1test "example" { return 1; }
22
3// return invalid type from test3// error
4// backend=stage1
5// target=native
6// is_test=1
4//7//
5// tmp.zig:1:25: error: expected type 'void', found 'comptime_int'8// 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 {...@@ -23,7 +23,10 @@ export fn entry() void {
23 S.d();23 S.d();
24}24}
2525
26// shift on type with non-power-of-two size26// error
27// backend=stage1
28// target=native
29// is_test=1
27//30//
28// tmp.zig:5:19: error: RHS of shift is too large for LHS type31// tmp.zig:5:19: error: RHS of shift is too large for LHS type
29// tmp.zig:9:19: error: RHS of shift is too large for LHS type32// 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 {...@@ -5,7 +5,10 @@ export fn entry() void {
5 _ = z;5 _ = z;
6}6}
77
8// @shuffle with selected index past first vector length8// error
9// backend=stage1
10// target=native
11// is_test=1
9//12//
10// tmp.zig:4:39: error: mask index '4' has out-of-bounds selection13// tmp.zig:4:39: error: mask index '4' has out-of-bounds selection
11// tmp.zig:4:27: note: selected index '7' out of bounds of @Vector(4, u32)14// 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 {...@@ -7,7 +7,10 @@ pub export fn entry() void {
7 }7 }
8}8}
99
10// switch ranges endpoints are validated10// error
11// backend=stage1
12// target=native
13// is_test=1
11//14//
12// tmp.zig:4:9: error: range start value is greater than the end value15// tmp.zig:4:9: error: range start value is greater than the end value
13// tmp.zig:5:9: error: range start value is greater than the end value16// 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 {...@@ -11,6 +11,9 @@ pub export fn entry() void {
11 }11 }
12}12}
1313
14// switching with exhaustive enum has '_' prong 14// error
15// backend=stage1
16// target=native
17// is_test=1
15//18//
16// tmp.zig:7:5: error: switch on exhaustive enum has `_` prong19// 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 {...@@ -25,7 +25,10 @@ pub export fn entry() void {
25 }25 }
26}26}
2727
28// switching with non-exhaustive enums28// error
29// backend=stage1
30// target=native
31// is_test=1
29//32//
30// tmp.zig:12:5: error: enumeration value 'E.b' not handled in switch33// tmp.zig:12:5: error: enumeration value 'E.b' not handled in switch
31// tmp.zig:16:5: error: switch on non-exhaustive enum must include `else` or `_` prong34// 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" {...@@ -3,6 +3,9 @@ test "enum" {
3 _ = @tagName(@intToEnum(E, 5));3 _ = @tagName(@intToEnum(E, 5));
4}4}
55
6// @tagName on invalid value of non-exhaustive enum6// error
7// backend=stage1
8// target=native
9// is_test=1
7//10//
8// tmp.zig:3:18: error: no tag by value 511// 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 {...@@ -6,6 +6,9 @@ export fn main() void {
6 _ = x;6 _ = x;
7}7}
88
9// type mismatch in C prototype with varargs9// error
10// backend=stage1
11// target=native
12// is_test=1
10//13//
11// tmp.zig:5:22: error: expected type 'fn([*c]u8, ...) callconv(.C) void', found 'fn([*:0]u8, ...) callconv(.C) void'14// 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 {...@@ -3,6 +3,9 @@ export fn entry() void {
3 x = x ++ .{ 1, 2, 3 };3 x = x ++ .{ 1, 2, 3 };
4}4}
55
6// type mismatch with tuple concatenation6// error
7// backend=stage1
8// target=native
9// is_test=1
7//10//
8// tmp.zig:3:11: error: expected type 'struct:2:14', found 'struct:3:11'11// 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 {...@@ -15,6 +15,7 @@ export fn entry() void {
15}15}
1616
17// error17// error
18// target=native
18//19//
19// :4:5: error: unreachable code20// :4:5: error: unreachable code
20// :4:25: note: control flow is diverted here21// :4:25: note: control flow is diverted here
test/compile_errors/stage2/duplicate-unused_labels.zig+1
...@@ -18,6 +18,7 @@ comptime {...@@ -18,6 +18,7 @@ comptime {
18}18}
1919
20// error20// error
21// target=native
21//22//
22// :2:12: error: redefinition of label 'blk'23// :2:12: error: redefinition of label 'blk'
23// :2:5: note: previous definition here24// :2:5: note: previous definition here
test/compile_errors/stage2/embed_outside_package.zig+1
...@@ -3,5 +3,6 @@ export fn a() usize {...@@ -3,5 +3,6 @@ export fn a() usize {
3}3}
44
5// error5// error
6// target=native
6//7//
7//:2:23: error: embed of file outside package path: '/root/foo'8//: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 {...@@ -3,5 +3,6 @@ export fn a() usize {
3}3}
44
5// error5// error
6// target=native
6//7//
7// :2:20: error: import of file outside package path: '../../above.zig'8// :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 {...@@ -21,6 +21,7 @@ comptime {
21}21}
2222
23// error23// error
24// target=native
24//25//
25// :4:26: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)26// :4:26: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)
26// :9:22: error: end index 6 out of bounds for array of length 4 +1 (sentinel)27// :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 {...@@ -6,5 +6,6 @@ comptime {
6}6}
77
8// error8// error
9// target=native
9//10//
10// :4:14: error: slice of null pointer11// :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 {...@@ -9,6 +9,7 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// target=native
12//13//
13// :3:5: error: duplicate struct field: 'foo'14// :3:5: error: duplicate struct field: 'foo'
14// :2:5: note: other field here15// :2:5: note: other field here
test/compile_errors/stage2/union_access_of_inactive_field.zig+1
...@@ -9,6 +9,7 @@ comptime {...@@ -9,6 +9,7 @@ comptime {
9}9}
1010
11// error11// error
12// target=native
12//13//
13// :7:16: error: access of union field 'b' while field 'a' is active14// :7:16: error: access of union field 'b' while field 'a' is active
14// :1:11: note: union declared here15// :1:11: note: union declared here
test/compile_errors/stage2/union_duplicate_enum_field.zig+1
...@@ -10,6 +10,7 @@ export fn foo() void {...@@ -10,6 +10,7 @@ export fn foo() void {
10}10}
1111
12// error12// error
13// target=native
13//14//
14// :4:5: error: duplicate union field: 'a'15// :4:5: error: duplicate union field: 'a'
15// :3:5: note: other field here16// :3:5: note: other field here
test/compile_errors/stage2/union_duplicate_field_definition.zig+1
...@@ -9,6 +9,7 @@ export fn entry() void {...@@ -9,6 +9,7 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// target=native
12//13//
13// :3:5: error: duplicate union field: 'foo'14// :3:5: error: duplicate union field: 'foo'
14// :2:5: note: other field here15// :2:5: note: other field here
test/compile_errors/stage2/union_enum_field_missing.zig+1
...@@ -14,6 +14,7 @@ export fn entry() usize {...@@ -14,6 +14,7 @@ export fn entry() usize {
14}14}
1515
16// error16// error
17// target=native
17//18//
18// :7:1: error: enum field(s) missing in union19// :7:1: error: enum field(s) missing in union
19// :4:5: note: field 'c' missing, declared here20// :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 {...@@ -14,6 +14,7 @@ export fn entry() usize {
14}14}
1515
16// error16// error
17// target=native
17//18//
18// :6:1: error: enum 'tmp.E' has no field named 'd'19// :6:1: error: enum 'tmp.E' has no field named 'd'
19// :1:11: note: enum declared here20// :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 {...@@ -15,6 +15,7 @@ export fn doTheTest() u64 {
15}15}
1616
17// error17// error
18// target=native
18//19//
19// :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields20// :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields
20// :6:5: note: field 'a' has type 'u32'21// :6:5: note: field 'a' has type 'u32'