authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-17 08:11:41+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-09-17 08:11:41+02:00
log9819f53453a95aee97bc12854e6d7653b597c2b3
tree466798b15ec9ad8f598555696332deb4dd697aae
parent580b6d1faddd0f2ef0c4e00fb042665b2cbdfa24
parentaae90762cc96fc19ee2ba3aa64a54ca1fcee842b
signaturebadge-check Signed by PGP key B5690EEEBB952194

Some miscellaneous test suite cleanups (#25256)

* test: remove test-compare-output and test-asm-link tests These were low value and unfocused tests. We already have coverage of the important aspects of these tests elsewhere. Additionally, there was really no need for these to have their own test harness. * test: rename issue_8550 standalone test to compile_asm * test: rename backend=stage2 to backend=selfhosted, and add backend=auto backend=auto (now the default if backend is omitted) means to let the compiler pick whatever backend it wants as the default. This is important for platforms where we don't yet have a self-hosted backend, such as loongarch64. Also purge a bunch of redundant target=native. * test: delete old stage1 compile_errors tests generic_function_returning_opaque_type.zig was salvaged as it's still worth having. * test: pull tests in test/cases/llvm/ up to test/cases/ There is nothing inherently LLVM-specific about any of these. * test: remove @cImport usage in interdependent_static_c_libs * test: move glibc_compat from link to standalone tests This is not really testing the linker. * build: -Dskip-translate-c now implies -Dskip-run-translated-c * build: skip test-cimport when -Dskip-translate-c is given

909 files changed, 1208 insertions(+), 3147 deletions(-)

build.zig+22-22
...@@ -91,7 +91,7 @@ pub fn build(b: *std.Build) !void {...@@ -91,7 +91,7 @@ pub fn build(b: *std.Build) !void {
91 const skip_single_threaded = b.option(bool, "skip-single-threaded", "Main test suite skips tests that are single-threaded") orelse false;91 const skip_single_threaded = b.option(bool, "skip-single-threaded", "Main test suite skips tests that are single-threaded") orelse false;
92 const skip_compile_errors = b.option(bool, "skip-compile-errors", "Main test suite skips compile error tests") orelse false;92 const skip_compile_errors = b.option(bool, "skip-compile-errors", "Main test suite skips compile error tests") orelse false;
93 const skip_translate_c = b.option(bool, "skip-translate-c", "Main test suite skips translate-c tests") orelse false;93 const skip_translate_c = b.option(bool, "skip-translate-c", "Main test suite skips translate-c tests") orelse false;
94 const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false;94 const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse skip_translate_c;
95 const skip_freebsd = b.option(bool, "skip-freebsd", "Main test suite skips targets with freebsd OS") orelse false;95 const skip_freebsd = b.option(bool, "skip-freebsd", "Main test suite skips targets with freebsd OS") orelse false;
96 const skip_netbsd = b.option(bool, "skip-netbsd", "Main test suite skips targets with netbsd OS") orelse false;96 const skip_netbsd = b.option(bool, "skip-netbsd", "Main test suite skips targets with netbsd OS") orelse false;
97 const skip_windows = b.option(bool, "skip-windows", "Main test suite skips targets with windows OS") orelse false;97 const skip_windows = b.option(bool, "skip-windows", "Main test suite skips targets with windows OS") orelse false;
...@@ -464,25 +464,27 @@ pub fn build(b: *std.Build) !void {...@@ -464,25 +464,27 @@ pub fn build(b: *std.Build) !void {
464 .max_rss = 4000000000,464 .max_rss = 4000000000,
465 }));465 }));
466466
467 test_modules_step.dependOn(tests.addModuleTests(b, .{467 if (!skip_translate_c) {
468 .test_filters = test_filters,468 test_modules_step.dependOn(tests.addModuleTests(b, .{
469 .test_target_filters = test_target_filters,469 .test_filters = test_filters,
470 .test_extra_targets = test_extra_targets,470 .test_target_filters = test_target_filters,
471 .root_src = "test/c_import.zig",471 .test_extra_targets = test_extra_targets,
472 .name = "c-import",472 .root_src = "test/c_import.zig",
473 .desc = "Run the @cImport tests",473 .name = "c-import",
474 .optimize_modes = optimization_modes,474 .desc = "Run the @cImport tests",
475 .include_paths = &.{"test/c_import"},475 .optimize_modes = optimization_modes,
476 .skip_single_threaded = true,476 .include_paths = &.{"test/c_import"},
477 .skip_non_native = skip_non_native,477 .skip_single_threaded = true,
478 .skip_freebsd = skip_freebsd,478 .skip_non_native = skip_non_native,
479 .skip_netbsd = skip_netbsd,479 .skip_freebsd = skip_freebsd,
480 .skip_windows = skip_windows,480 .skip_netbsd = skip_netbsd,
481 .skip_macos = skip_macos,481 .skip_windows = skip_windows,
482 .skip_linux = skip_linux,482 .skip_macos = skip_macos,
483 .skip_llvm = skip_llvm,483 .skip_linux = skip_linux,
484 .skip_libc = skip_libc,484 .skip_llvm = skip_llvm,
485 }));485 .skip_libc = skip_libc,
486 }));
487 }
486488
487 test_modules_step.dependOn(tests.addModuleTests(b, .{489 test_modules_step.dependOn(tests.addModuleTests(b, .{
488 .test_filters = test_filters,490 .test_filters = test_filters,
...@@ -568,7 +570,6 @@ pub fn build(b: *std.Build) !void {...@@ -568,7 +570,6 @@ pub fn build(b: *std.Build) !void {
568 unit_tests.root_module.addOptions("build_options", exe_options);570 unit_tests.root_module.addOptions("build_options", exe_options);
569 unit_tests_step.dependOn(&b.addRunArtifact(unit_tests).step);571 unit_tests_step.dependOn(&b.addRunArtifact(unit_tests).step);
570572
571 test_step.dependOn(tests.addCompareOutputTests(b, test_filters, optimization_modes));
572 test_step.dependOn(tests.addStandaloneTests(573 test_step.dependOn(tests.addStandaloneTests(
573 b,574 b,
574 optimization_modes,575 optimization_modes,
...@@ -590,7 +591,6 @@ pub fn build(b: *std.Build) !void {...@@ -590,7 +591,6 @@ pub fn build(b: *std.Build) !void {
590 test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));591 test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));
591 test_step.dependOn(tests.addStackTraceTests(b, test_filters, optimization_modes));592 test_step.dependOn(tests.addStackTraceTests(b, test_filters, optimization_modes));
592 test_step.dependOn(tests.addCliTests(b));593 test_step.dependOn(tests.addCliTests(b));
593 test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filters, optimization_modes));
594 if (tests.addDebuggerTests(b, .{594 if (tests.addDebuggerTests(b, .{
595 .test_filters = test_filters,595 .test_filters = test_filters,
596 .test_target_filters = test_target_filters,596 .test_target_filters = test_target_filters,
ci/riscv64-linux-debug.sh+1-1
...@@ -49,7 +49,7 @@ unset CXX...@@ -49,7 +49,7 @@ unset CXX
49ninja install49ninja install
5050
51# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.51# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
52stage3-debug/bin/zig build test-cases test-modules test-unit test-c-abi test-stack-traces test-asm-link test-llvm-ir \52stage3-debug/bin/zig build test-cases test-modules test-unit test-c-abi test-stack-traces test-llvm-ir \
53 --maxrss 68719476736 \53 --maxrss 68719476736 \
54 -Dstatic-llvm \54 -Dstatic-llvm \
55 -Dskip-non-native \55 -Dskip-non-native \
ci/riscv64-linux-release.sh+1-1
...@@ -49,7 +49,7 @@ unset CXX...@@ -49,7 +49,7 @@ unset CXX
49ninja install49ninja install
5050
51# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.51# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
52stage3-release/bin/zig build test-cases test-modules test-unit test-c-abi test-stack-traces test-asm-link test-llvm-ir \52stage3-release/bin/zig build test-cases test-modules test-unit test-c-abi test-stack-traces test-llvm-ir \
53 --maxrss 68719476736 \53 --maxrss 68719476736 \
54 -Dstatic-llvm \54 -Dstatic-llvm \
55 -Dskip-non-native \55 -Dskip-non-native \
test/assemble_and_link.zig deleted-27
...@@ -1,27 +0,0 @@
1const std = @import("std");
2const builtin = @import("builtin");
3const tests = @import("tests.zig");
4
5pub fn addCases(cases: *tests.CompareOutputContext) void {
6 if (builtin.os.tag == .linux and builtin.cpu.arch == .x86_64) {
7 cases.addAsm("hello world linux x86_64",
8 \\.text
9 \\.globl _start
10 \\
11 \\_start:
12 \\ mov $1, %rax
13 \\ mov $1, %rdi
14 \\ mov $msg, %rsi
15 \\ mov $14, %rdx
16 \\ syscall
17 \\
18 \\ mov $60, %rax
19 \\ mov $0, %rdi
20 \\ syscall
21 \\
22 \\.data
23 \\msg:
24 \\ .ascii "Hello, world!\n"
25 , "Hello, world!\n");
26 }
27}
test/cases/README.md+4-4
...@@ -77,12 +77,12 @@ path will be prepended as a prefix on the test case name....@@ -77,12 +77,12 @@ path will be prepended as a prefix on the test case name.
7777
78```zig78```zig
79// run79// run
80// backend=stage2,llvm80// backend=selfhosted,llvm
81// target=x86_64-linux,x86_64-macos81// target=x86_64-linux,x86_64-macos
82```82```
8383
84Possible backends are:84Possible backends are:
8585
86 * `stage1`: equivalent to `-fstage1`.86 * `auto`: the default; compiler picks the backend based on robustness.
87 * `stage2`: equivalent to passing `-fno-stage1 -fno-LLVM`.87 * `selfhosted`: equivalent to passing `-fno-llvm -fno-lld`.
88 * `llvm`: equivalent to `-fLLVM -fno-stage1`.88 * `llvm`: equivalent to `-fllvm`.
test/cases/address_of_extern_var_as_const.zig+1-1
...@@ -6,5 +6,5 @@ export const p_external_variable = &external_variable;...@@ -6,5 +6,5 @@ export const p_external_variable = &external_variable;
66
7// compile7// compile
8// output_mode=Obj8// output_mode=Obj
9// backend=stage2,llvm9// backend=selfhosted,llvm
10// target=x86_64-linux10// target=x86_64-linux
test/cases/address_space_pointer_access_chaining_pointer_to_optional_array.zig created+12
...@@ -0,0 +1,12 @@
1fn entry(a: *addrspace(.gs) ?[1]i32) *addrspace(.gs) i32 {
2 return &a.*.?[0];
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=selfhosted,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/address_spaces_pointer_access_chaining_array_pointer.zig created+12
...@@ -0,0 +1,12 @@
1fn entry(a: *addrspace(.gs) [1]i32) *addrspace(.gs) i32 {
2 return &a[0];
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=selfhosted,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/address_spaces_pointer_access_chaining_complex.zig created+13
...@@ -0,0 +1,13 @@
1const A = struct { a: ?[1]i32 };
2fn entry(a: *addrspace(.gs) [1]A) *addrspace(.gs) i32 {
3 return &a[0].a.?[0];
4}
5pub fn main() void {
6 _ = &entry;
7}
8
9// compile
10// output_mode=Exe
11// backend=selfhosted,llvm
12// target=x86_64-linux,x86_64-macos
13//
test/cases/address_spaces_pointer_access_chaining_struct_pointer.zig created+13
...@@ -0,0 +1,13 @@
1const A = struct { a: i32 };
2fn entry(a: *addrspace(.gs) A) *addrspace(.gs) i32 {
3 return &a.a;
4}
5pub fn main() void {
6 _ = &entry;
7}
8
9// compile
10// output_mode=Exe
11// backend=selfhosted,llvm
12// target=x86_64-linux,x86_64-macos
13//
test/cases/array_in_anon_struct.zig+1-1
...@@ -18,5 +18,5 @@ pub fn main() !void {...@@ -18,5 +18,5 @@ pub fn main() !void {
18}18}
1919
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=x86_64-linux,aarch64-linux22// target=x86_64-linux,aarch64-linux
test/cases/bad_inferred_variable_type.zig deleted-10
...@@ -1,10 +0,0 @@
1pub fn main() void {
2 var x = null;
3 _ = &x;
4}
5
6// error
7// output_mode=Exe
8// backend=stage2
9//
10// :2:9: error: variable of type '@TypeOf(null)' must be const or comptime
test/cases/blocks.zig created+23
...@@ -0,0 +1,23 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5fn foo(ok: bool) i32 {
6 const val: i32 = blk: {
7 var x: i32 = 1;
8 _ = &x;
9 if (!ok) break :blk x + 9;
10 break :blk x + 19;
11 };
12 return val + 10;
13}
14
15pub fn main() void {
16 assert(foo(false) == 20);
17 assert(foo(true) == 30);
18}
19
20// run
21// backend=selfhosted,llvm
22// target=x86_64-linux,x86_64-macos
23//
test/cases/comparison_of_non-tagged_union_and_enum_literal.zig deleted-14
...@@ -1,14 +0,0 @@
1export fn entry() void {
2 const U = union { A: u32, B: u64 };
3 var u = U{ .A = 42 };
4 var ok = u == .A;
5 _ = &u;
6 _ = &ok;
7}
8
9// error
10// backend=stage2
11// target=native
12//
13// :4:14: error: comparison of union and enum literal is only valid for tagged union types
14// :2:15: note: union 'tmp.entry.U' is not a tagged union
test/cases/compile_errors/@embedFile_with_empty_path.zig-2
...@@ -5,7 +5,5 @@ export fn entry() usize {...@@ -5,7 +5,5 @@ export fn entry() usize {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :1:29: error: file path name cannot be empty9// :1:29: error: file path name cannot be empty
test/cases/compile_errors/@errorCast_with_bad_type.zig-1
...@@ -20,7 +20,6 @@ pub export fn entry4() void {...@@ -20,7 +20,6 @@ pub export fn entry4() void {
20}20}
2121
22// error22// error
23// backend=stage2
24// target=x86_64-linux23// target=x86_64-linux
25//24//
26// :4:25: error: expected error set or error union type, found 'comptime_int'25// :4:25: error: expected error set or error union type, found 'comptime_int'
test/cases/compile_errors/@intCast_on_vec.zig-1
...@@ -7,7 +7,6 @@ export fn entry() void {...@@ -7,7 +7,6 @@ export fn entry() void {
7// https://github.com/ziglang/zig/issues/137827// https://github.com/ziglang/zig/issues/13782
88
9// error9// error
10// backend=stage2
11// target=x86_64-linux10// target=x86_64-linux
12//11//
13// :3:27: error: expected type 'u32', found '@Vector(4, u32)'12// :3:27: error: expected type 'u32', found '@Vector(4, u32)'
test/cases/compile_errors/@intFromPtr_with_bad_type.zig-2
...@@ -5,7 +5,5 @@ pub export fn entry() void {...@@ -5,7 +5,5 @@ pub export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:23: error: comptime-only type 'comptime_int' has no pointer address9// :2:23: error: comptime-only type 'comptime_int' has no pointer address
test/cases/compile_errors/@trap_comptime_call.zig-2
...@@ -3,7 +3,5 @@ export fn entry() void {...@@ -3,7 +3,5 @@ export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:14: error: encountered @trap at comptime7// :2:14: error: encountered @trap at comptime
test/cases/compile_errors/AstGen_comptime_known_struct_is_resolved_before_error.zig-2
...@@ -10,8 +10,6 @@ pub export fn entry() void {...@@ -10,8 +10,6 @@ pub export fn entry() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :8:12: error: variable of type 'tmp.S1' must be const or comptime14// :8:12: error: variable of type 'tmp.S1' must be const or comptime
17// :2:8: note: struct requires comptime because of this field15// :2:8: note: struct requires comptime because of this field
test/cases/compile_errors/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig-2
...@@ -6,8 +6,6 @@ export fn a() void {...@@ -6,8 +6,6 @@ export fn a() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :3:19: error: C pointers cannot point to non-C-ABI-compatible type 'tmp.Foo'10// :3:19: error: C pointers cannot point to non-C-ABI-compatible type 'tmp.Foo'
13// :3:19: note: only extern structs and ABI sized packed structs are extern compatible11// :3:19: note: only extern structs and ABI sized packed structs are extern compatible
test/cases/compile_errors/C_pointer_to_anyopaque.zig-2
...@@ -5,7 +5,5 @@ export fn a() void {...@@ -5,7 +5,5 @@ export fn a() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:16: error: C pointers cannot point to opaque types9// :3:16: error: C pointers cannot point to opaque types
test/cases/compile_errors/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig-2
...@@ -8,8 +8,6 @@ export fn f2(x: @Vector(4, u32)) @Vector(4, u32) {...@@ -8,8 +8,6 @@ export fn f2(x: @Vector(4, u32)) @Vector(4, u32) {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:12: error: negation of type 'u32'12// :3:12: error: negation of type 'u32'
15// :7:12: error: negation of type '@Vector(4, u32)'13// :7:12: error: negation of type '@Vector(4, u32)'
test/cases/compile_errors/Issue_6823_dont_allow_._to_be_followed_by_.zig-2
...@@ -4,7 +4,5 @@ fn foo() void {...@@ -4,7 +4,5 @@ fn foo() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:28: error: '.*' cannot be followed by '*'; are you missing a space?8// :2:28: error: '.*' cannot be followed by '*'; are you missing a space?
test/cases/compile_errors/access_inactive_union_field_comptime.zig-2
...@@ -15,8 +15,6 @@ pub export fn entry1() void {...@@ -15,8 +15,6 @@ pub export fn entry1() void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :9:15: error: access of union field 'a' while field 'b' is active19// :9:15: error: access of union field 'a' while field 'b' is active
22// :2:21: note: union declared here20// :2:21: note: union declared here
test/cases/compile_errors/access_non-existent_member_of_error_set.zig-2
...@@ -5,7 +5,5 @@ comptime {...@@ -5,7 +5,5 @@ comptime {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:18: error: no error named 'Bar' in 'error{A}'9// :3:18: error: no error named 'Bar' in 'error{A}'
test/cases/compile_errors/accessing_runtime_parameter_from_outer_function.zig-2
...@@ -13,8 +13,6 @@ export fn entry() void {...@@ -13,8 +13,6 @@ export fn entry() void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :4:24: error: 'y' not accessible from inner function17// :4:24: error: 'y' not accessible from inner function
20// :3:9: note: crossed function definition here18// :3:9: note: crossed function definition here
test/cases/compile_errors/accessing_runtime_paramter_outside_function_scope.zig-2
...@@ -6,7 +6,5 @@ export fn entry(y: u8) void {...@@ -6,7 +6,5 @@ export fn entry(y: u8) void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :3:17: error: 'y' not accessible outside function scope10// :3:17: error: 'y' not accessible outside function scope
test/cases/compile_errors/add_sat_on_undefined_value.zig-2
...@@ -15,8 +15,6 @@ comptime {...@@ -15,8 +15,6 @@ comptime {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :6:5: error: found compile log statement19// :6:5: error: found compile log statement
22//20//
test/cases/compile_errors/add_wrap_on_undefined_value.zig-2
...@@ -15,8 +15,6 @@ comptime {...@@ -15,8 +15,6 @@ comptime {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :6:5: error: found compile log statement19// :6:5: error: found compile log statement
22//20//
test/cases/compile_errors/addition_with_non_numbers.zig-2
...@@ -8,7 +8,5 @@ export fn entry() usize {...@@ -8,7 +8,5 @@ export fn entry() usize {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:29: error: invalid operands to binary expression: 'struct' and 'struct'12// :4:29: error: invalid operands to binary expression: 'struct' and 'struct'
test/cases/compile_errors/address_of_number_literal.zig-2
...@@ -8,8 +8,6 @@ export fn entry() usize {...@@ -8,8 +8,6 @@ export fn entry() usize {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:12: error: expected type '*const i32', found '*const comptime_int'12// :4:12: error: expected type '*const i32', found '*const comptime_int'
15// :4:12: note: pointer type child 'comptime_int' cannot cast into pointer type child 'i32'13// :4:12: note: pointer type child 'comptime_int' cannot cast into pointer type child 'i32'
test/cases/compile_errors/alignCast_expects_pointer_or_slice.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:41: error: expected pointer type, found 'u32'8// :2:41: error: expected pointer type, found 'u32'
test/cases/compile_errors/alignOf_bad_type.zig-2
...@@ -3,7 +3,5 @@ export fn entry() usize {...@@ -3,7 +3,5 @@ export fn entry() usize {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:21: error: no align available for type 'noreturn'7// :2:21: error: no align available for type 'noreturn'
test/cases/compile_errors/align_n_expr_function_pointers_is_a_compile_error.zig-1
...@@ -3,7 +3,6 @@ export fn foo() align(1) void {...@@ -3,7 +3,6 @@ export fn foo() align(1) void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=wasm32-freestanding-none6// target=wasm32-freestanding-none
8//7//
9// :1:23: error: target does not support function alignment8// :1:23: error: target does not support function alignment
test/cases/compile_errors/alignment_of_enum_field_specified.zig-2
...@@ -11,7 +11,5 @@ export fn entry1() void {...@@ -11,7 +11,5 @@ export fn entry1() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :4:13: error: enum fields cannot be aligned15// :4:13: error: enum fields cannot be aligned
test/cases/compile_errors/ambiguous_coercion_of_division_operands.zig-2
...@@ -16,8 +16,6 @@ export fn entry4() void {...@@ -16,8 +16,6 @@ export fn entry4() void {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :2:25: error: ambiguous coercion of division operands 'comptime_float' and 'comptime_int'; non-zero remainder '4'20// :2:25: error: ambiguous coercion of division operands 'comptime_float' and 'comptime_int'; non-zero remainder '4'
23// :6:23: error: ambiguous coercion of division operands 'comptime_int' and 'comptime_float'; non-zero remainder '4'21// :6:23: error: ambiguous coercion of division operands 'comptime_int' and 'comptime_float'; non-zero remainder '4'
test/cases/compile_errors/ambiguous_decl_reference.zig-2
...@@ -13,8 +13,6 @@ export fn entry() void {...@@ -13,8 +13,6 @@ export fn entry() void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :5:13: error: ambiguous reference17// :5:13: error: ambiguous reference
20// :7:9: note: declared here18// :7:9: note: declared here
test/cases/compile_errors/any_typed_null_to_any_typed_optional.zig-2
...@@ -4,8 +4,6 @@ pub export fn entry() void {...@@ -4,8 +4,6 @@ pub export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:9: error: expected type '?*anyopaque', found '?usize'8// :3:9: error: expected type '?*anyopaque', found '?usize'
11// :3:9: note: optional type child 'usize' cannot cast into optional type child '*anyopaque'9// :3:9: note: optional type child 'usize' cannot cast into optional type child '*anyopaque'
test/cases/compile_errors/array_access_of_non_array.zig-2
...@@ -8,8 +8,6 @@ export fn g() void {...@@ -8,8 +8,6 @@ export fn g() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:8: error: type 'bool' does not support indexing12// :3:8: error: type 'bool' does not support indexing
15// :3:8: note: operand must be an array, slice, tuple, or vector13// :3:8: note: operand must be an array, slice, tuple, or vector
test/cases/compile_errors/array_access_of_type.zig-2
...@@ -4,8 +4,6 @@ export fn foo() void {...@@ -4,8 +4,6 @@ export fn foo() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:14: error: type 'type' does not support indexing8// :2:14: error: type 'type' does not support indexing
11// :2:14: note: operand must be an array, slice, tuple, or vector9// :2:14: note: operand must be an array, slice, tuple, or vector
test/cases/compile_errors/array_access_of_undeclared_identifier.zig-2
...@@ -3,7 +3,5 @@ export fn f() void {...@@ -3,7 +3,5 @@ export fn f() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:5: error: use of undeclared identifier 'i'7// :2:5: error: use of undeclared identifier 'i'
test/cases/compile_errors/array_access_with_non_integer_index.zig-2
...@@ -12,8 +12,6 @@ export fn g() void {...@@ -12,8 +12,6 @@ export fn g() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :4:11: error: expected type 'usize', found 'bool'16// :4:11: error: expected type 'usize', found 'bool'
19// :10:15: error: expected type 'usize', found 'bool'17// :10:15: error: expected type 'usize', found 'bool'
test/cases/compile_errors/array_concatenation_with_wrong_type.zig-2
...@@ -7,7 +7,5 @@ export fn entry() usize {...@@ -7,7 +7,5 @@ export fn entry() usize {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :3:11: error: expected indexable; found 'usize'11// :3:11: error: expected indexable; found 'usize'
test/cases/compile_errors/array_init_invalid_elem_count.zig-2
...@@ -32,8 +32,6 @@ export fn entry3() void {...@@ -32,8 +32,6 @@ export fn entry3() void {
32}32}
3333
34// error34// error
35// backend=stage2
36// target=native
37//35//
38// :4:17: error: expected 8 vector elements; found 136// :4:17: error: expected 8 vector elements; found 1
39// :8:17: error: expected 8 vector elements; found 037// :8:17: error: expected 8 vector elements; found 0
test/cases/compile_errors/array_init_not_supported_on_result_type.zig-2
...@@ -5,7 +5,5 @@ export fn foo() void {...@@ -5,7 +5,5 @@ export fn foo() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :4:12: error: type 'u32' does not support array initialization syntax9// :4:12: error: type 'u32' does not support array initialization syntax
test/cases/compile_errors/asm_at_compile_time.zig-2
...@@ -11,8 +11,6 @@ fn doSomeAsm() void {...@@ -11,8 +11,6 @@ fn doSomeAsm() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :6:5: error: unable to evaluate comptime expression15// :6:5: error: unable to evaluate comptime expression
18// :2:14: note: called at comptime from here16// :2:14: note: called at comptime from here
test/cases/compile_errors/asm_output_to_const.zig-2
...@@ -8,7 +8,5 @@ export fn foo() void {...@@ -8,7 +8,5 @@ export fn foo() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:5: error: asm cannot output to const local 'f'12// :4:5: error: asm cannot output to const local 'f'
test/cases/compile_errors/assign_inline_fn_to_non-comptime_var.zig-2
...@@ -5,8 +5,6 @@ export fn entry() void {...@@ -5,8 +5,6 @@ export fn entry() void {
5inline fn b() void {}5inline fn b() void {}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:9: error: variable of type '*const fn () callconv(.@"inline") void' must be const or comptime9// :2:9: error: variable of type '*const fn () callconv(.@"inline") void' must be const or comptime
12// :2:9: note: function has inline calling convention10// :2:9: note: function has inline calling convention
test/cases/compile_errors/assign_local_bad_coercion.zig-2
...@@ -13,8 +13,6 @@ export fn varEntry() u32 {...@@ -13,8 +13,6 @@ export fn varEntry() u32 {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :6:21: error: expected type 'u32', found 'u64'17// :6:21: error: expected type 'u32', found 'u64'
20// :6:21: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values18// :6:21: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
test/cases/compile_errors/assign_null_to_non-optional_pointer.zig-2
...@@ -5,7 +5,5 @@ export fn entry() usize {...@@ -5,7 +5,5 @@ export fn entry() usize {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :1:16: error: expected type '*u8', found '@TypeOf(null)'9// :1:16: error: expected type '*u8', found '@TypeOf(null)'
test/cases/compile_errors/assign_through_constant_pointer.zig-2
...@@ -4,7 +4,5 @@ export fn f() void {...@@ -4,7 +4,5 @@ export fn f() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:9: error: cannot assign to constant8// :3:9: error: cannot assign to constant
test/cases/compile_errors/assign_through_constant_slice.zig-2
...@@ -4,7 +4,5 @@ export fn f() void {...@@ -4,7 +4,5 @@ export fn f() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:9: error: cannot assign to constant8// :3:9: error: cannot assign to constant
test/cases/compile_errors/assign_to_constant_field.zig-2
...@@ -9,7 +9,5 @@ export fn derp() void {...@@ -9,7 +9,5 @@ export fn derp() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :8:6: error: cannot assign to constant13// :8:6: error: cannot assign to constant
test/cases/compile_errors/assign_to_invalid_dereference.zig-2
...@@ -3,7 +3,5 @@ export fn entry() void {...@@ -3,7 +3,5 @@ export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:8: error: cannot dereference non-pointer type 'comptime_int'7// :2:8: error: cannot dereference non-pointer type 'comptime_int'
test/cases/compile_errors/assign_too_big_number_to_u16.zig-2
...@@ -4,7 +4,5 @@ export fn foo() void {...@@ -4,7 +4,5 @@ export fn foo() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:26: error: type 'u16' cannot represent integer value '753664'8// :2:26: error: type 'u16' cannot represent integer value '753664'
test/cases/compile_errors/assign_unreachable.zig-2
...@@ -4,8 +4,6 @@ export fn f() void {...@@ -4,8 +4,6 @@ export fn f() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:5: error: unreachable code8// :2:5: error: unreachable code
11// :2:15: note: control flow is diverted here9// :2:15: note: control flow is diverted here
test/cases/compile_errors/assigning_to_struct_or_union_fields_that_are_not_optionals_with_a_function_that_returns_an_optional.zig-2
...@@ -15,8 +15,6 @@ export fn entry() void {...@@ -15,8 +15,6 @@ export fn entry() void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :11:20: error: expected type 'u8', found '?u8'19// :11:20: error: expected type 'u8', found '?u8'
22// :11:20: note: cannot convert optional to payload type20// :11:20: note: cannot convert optional to payload type
test/cases/compile_errors/atomic_orderings_of_atomicStore_Acquire_or_AcqRel.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:31: error: @atomicStore atomic ordering must not be acquire or acq_rel8// :3:31: error: @atomicStore atomic ordering must not be acquire or acq_rel
test/cases/compile_errors/atomic_orderings_of_cmpxchg-failure_stricter_than_success.zig-2
...@@ -5,7 +5,5 @@ export fn f() void {...@@ -5,7 +5,5 @@ export fn f() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :4:81: error: failure atomic ordering must be no stricter than success9// :4:81: error: failure atomic ordering must be no stricter than success
test/cases/compile_errors/atomic_orderings_of_cmpxchg-success_Monotonic_or_stricter.zig-2
...@@ -5,7 +5,5 @@ export fn f() void {...@@ -5,7 +5,5 @@ export fn f() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :4:58: error: success atomic ordering must be monotonic or stricter9// :4:58: error: success atomic ordering must be monotonic or stricter
test/cases/compile_errors/atomicrmw_with_bool_op_not_.Xchg.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:31: error: @atomicRmw with bool only allowed with .Xchg8// :3:31: error: @atomicRmw with bool only allowed with .Xchg
test/cases/compile_errors/atomicrmw_with_enum_op_not_.Xchg.zig-2
...@@ -10,7 +10,5 @@ export fn entry() void {...@@ -10,7 +10,5 @@ export fn entry() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :9:28: error: @atomicRmw with enum only allowed with .Xchg14// :9:28: error: @atomicRmw with enum only allowed with .Xchg
test/cases/compile_errors/atomicrmw_with_float_op_not_.Xchg_.Add_.Sub_.Max_or_.Min.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:30: error: @atomicRmw with float only allowed with .Xchg, .Add, .Sub, .Max, and .Min8// :3:30: error: @atomicRmw with float only allowed with .Xchg, .Add, .Sub, .Max, and .Min
test/cases/compile_errors/atomics_with_invalid_type.zig-2
...@@ -21,8 +21,6 @@ export fn errorSet() void {...@@ -21,8 +21,6 @@ export fn errorSet() void {
21}21}
2222
23// error23// error
24// backend=stage2
25// target=native
26//24//
27// :3:22: error: expected bool, integer, enum, packed struct, or pointer type; found 'f32'25// :3:22: error: expected bool, integer, enum, packed struct, or pointer type; found 'f32'
28// :9:22: error: expected bool, integer, float, enum, packed struct, or pointer type; found 'tmp.NormalStruct'26// :9:22: error: expected bool, integer, float, enum, packed struct, or pointer type; found 'tmp.NormalStruct'
test/cases/compile_errors/attempt_to_cast_enum_literal_to_error.zig-2
...@@ -5,7 +5,5 @@ export fn entry() void {...@@ -5,7 +5,5 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:10: error: expected type 'error{Hi}', found '@Type(.enum_literal)'9// :3:10: error: expected type 'error{Hi}', found '@Type(.enum_literal)'
test/cases/compile_errors/attempt_to_close_over_comptime_variable_from_outer_scope.zig-2
...@@ -6,8 +6,6 @@ fn SimpleList(comptime L: usize) type {...@@ -6,8 +6,6 @@ fn SimpleList(comptime L: usize) type {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :4:19: error: mutable 'T' not accessible from here10// :4:19: error: mutable 'T' not accessible from here
13// :2:9: note: declared mutable here11// :2:9: note: declared mutable here
test/cases/compile_errors/attempt_to_create_17_bit_float_type.zig-2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:9: error: 17-bit float unsupported8// :3:9: error: 17-bit float unsupported
test/cases/compile_errors/attempt_to_negate_a_non-integer_non-float_or_non-vector_type.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :6:15: error: negation of type 'anyerror!u32'12// :6:15: error: negation of type 'anyerror!u32'
test/cases/compile_errors/attempted_double_ampersand.zig-2
...@@ -6,7 +6,5 @@ export fn entry(a: bool, b: bool) i32 {...@@ -6,7 +6,5 @@ export fn entry(a: bool, b: bool) i32 {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:11: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND10// :2:11: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND
test/cases/compile_errors/attempted_implicit_cast_from_T_to_long_array_ptr.zig-2
...@@ -9,8 +9,6 @@ export fn entry2(single: *u32) void {...@@ -9,8 +9,6 @@ export fn entry2(single: *u32) void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :2:28: error: expected type '*const [0]u32', found '*u32'13// :2:28: error: expected type '*const [0]u32', found '*u32'
16// :2:28: note: pointer type child 'u32' cannot cast into pointer type child '[0]u32'14// :2:28: note: pointer type child 'u32' cannot cast into pointer type child '[0]u32'
test/cases/compile_errors/attempted_implicit_cast_from_T_to_slice_const_T.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:30: error: expected type '[*]const bool', found 'bool'8// :2:30: error: expected type '[*]const bool', found 'bool'
test/cases/compile_errors/attempted_implicit_cast_from_const_T_to_array_len_1_T.zig-2
...@@ -7,8 +7,6 @@ export fn entry() void {...@@ -7,8 +7,6 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :4:22: error: expected type '*[1]i32', found '*const i32'11// :4:22: error: expected type '*[1]i32', found '*const i32'
14// :4:22: note: cast discards const qualifier12// :4:22: note: cast discards const qualifier
test/cases/compile_errors/attempted_implicit_cast_from_const_T_to_sliceT.zig-2
...@@ -5,8 +5,6 @@ export fn entry() void {...@@ -5,8 +5,6 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:22: error: expected type '[]u32', found '*const u32'9// :3:22: error: expected type '[]u32', found '*const u32'
12// :3:22: note: cast discards const qualifier10// :3:22: note: cast discards const qualifier
test/cases/compile_errors/bad_alignCast_at_comptime.zig-2
...@@ -5,7 +5,5 @@ comptime {...@@ -5,7 +5,5 @@ comptime {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:47: error: pointer address 0x1 is not aligned to 4 bytes9// :3:47: error: pointer address 0x1 is not aligned to 4 bytes
test/cases/compile_errors/bad_alignment_in_implicit_cast_from_array_pointer_to_slice.zig-2
...@@ -5,8 +5,6 @@ export fn a() void {...@@ -5,8 +5,6 @@ export fn a() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:31: error: expected type '[]align(16) u8', found '*[10]u8'9// :3:31: error: expected type '[]align(16) u8', found '*[10]u8'
12// :3:31: note: pointer alignment '1' cannot cast into pointer alignment '16'10// :3:31: note: pointer alignment '1' cannot cast into pointer alignment '16'
test/cases/compile_errors/bad_alignment_type.zig-2
...@@ -8,8 +8,6 @@ export fn entry2() void {...@@ -8,8 +8,6 @@ export fn entry2() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:22: error: expected type 'u29', found 'bool'12// :2:22: error: expected type 'u29', found 'bool'
15// :6:21: error: fractional component prevents float value '12.34' from coercion to type 'u29'13// :6:21: error: fractional component prevents float value '12.34' from coercion to type 'u29'
test/cases/compile_errors/bad_identifier_in_function_with_struct_defined_inside_function_which_references_local_const.zig-2
...@@ -11,7 +11,5 @@ export fn entry() void {...@@ -11,7 +11,5 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :8:5: error: use of undeclared identifier 'bogus'15// :8:5: error: use of undeclared identifier 'bogus'
test/cases/compile_errors/bad_inferred_variable_type.zig created+9
...@@ -0,0 +1,9 @@
1pub fn main() void {
2 var x = null;
3 _ = &x;
4}
5
6// error
7// output_mode=Exe
8//
9// :2:9: error: variable of type '@TypeOf(null)' must be const or comptime
test/cases/compile_errors/bad_member_access_on_tuple.zig-2
...@@ -3,7 +3,5 @@ comptime {...@@ -3,7 +3,5 @@ comptime {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:21: error: struct '@TypeOf(.{})' has no member named 'is_optional'7// :2:21: error: struct '@TypeOf(.{})' has no member named 'is_optional'
test/cases/compile_errors/bad_usage_of_call.zig-2
...@@ -36,8 +36,6 @@ noinline fn dummy() u32 {...@@ -36,8 +36,6 @@ noinline fn dummy() u32 {
36noinline fn dummy2() void {}36noinline fn dummy2() void {}
3737
38// error38// error
39// backend=stage2
40// target=native
41//39//
42// :2:23: error: expected a tuple, found 'void'40// :2:23: error: expected a tuple, found 'void'
43// :5:21: error: unable to perform 'never_inline' call at compile-time41// :5:21: error: unable to perform 'never_inline' call at compile-time
test/cases/compile_errors/binary_OR_operator_on_error_sets.zig-2
...@@ -6,7 +6,5 @@ export fn entry() void {...@@ -6,7 +6,5 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:18: error: invalid operands to binary bitwise expression: 'error_set' and 'error_set'10// :2:18: error: invalid operands to binary bitwise expression: 'error_set' and 'error_set'
test/cases/compile_errors/binary_not_on_number_literal.zig-2
...@@ -7,7 +7,5 @@ export fn entry() usize {...@@ -7,7 +7,5 @@ export fn entry() usize {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :3:61: error: bitwise not operation on type 'comptime_int'11// :3:61: error: bitwise not operation on type 'comptime_int'
test/cases/compile_errors/bitCast_same_size_but_bit_count_mismatch.zig-2
...@@ -4,7 +4,5 @@ export fn entry(byte: u8) void {...@@ -4,7 +4,5 @@ export fn entry(byte: u8) void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:22: error: @bitCast size mismatch: destination type 'u7' has 7 bits but source type 'u8' has 8 bits8// :2:22: error: @bitCast size mismatch: destination type 'u7' has 7 bits but source type 'u8' has 8 bits
test/cases/compile_errors/bitCast_to_enum_type.zig-2
...@@ -5,8 +5,6 @@ export fn entry() void {...@@ -5,8 +5,6 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:18: error: cannot @bitCast to 'tmp.entry.E'9// :3:18: error: cannot @bitCast to 'tmp.entry.E'
12// :3:18: note: use @enumFromInt to cast from 'u32'10// :3:18: note: use @enumFromInt to cast from 'u32'
test/cases/compile_errors/bitCast_with_different_sizes_inside_an_expression.zig-2
...@@ -5,7 +5,5 @@ export fn entry() void {...@@ -5,7 +5,5 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:26: error: @bitCast size mismatch: destination type 'u8' has 8 bits but source type 'f32' has 32 bits9// :3:26: error: @bitCast size mismatch: destination type 'u8' has 8 bits but source type 'f32' has 32 bits
test/cases/compile_errors/bit_shifting_only_works_on_integer_types.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:15: error: bit shifting operation expected integer type, found '*const u8'8// :2:15: error: bit shifting operation expected integer type, found '*const u8'
test/cases/compile_errors/bitsize_of_packed_struct_checks_backing_int_ty.zig-2
...@@ -7,7 +7,5 @@ pub export fn entry() void {...@@ -7,7 +7,5 @@ pub export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :1:27: error: backing integer type 'u32' has bit size 32 but the struct fields have a total bit size of 111// :1:27: error: backing integer type 'u32' has bit size 32 but the struct fields have a total bit size of 1
test/cases/compile_errors/bogus_compile_var.zig-2
...@@ -4,8 +4,6 @@ export fn entry() usize {...@@ -4,8 +4,6 @@ export fn entry() usize {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:29: error: root source file struct 'builtin' has no member named 'bogus'8// :1:29: error: root source file struct 'builtin' has no member named 'bogus'
11// note: struct declared here9// note: struct declared here
test/cases/compile_errors/bool_not_on_vector_of_ints.zig-2
...@@ -4,7 +4,5 @@ export fn foo() void {...@@ -4,7 +4,5 @@ export fn foo() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:10: error: boolean not operation on type '@Vector(2, u1)'8// :3:10: error: boolean not operation on type '@Vector(2, u1)'
test/cases/compile_errors/break_void_result_location.zig-2
...@@ -24,8 +24,6 @@ export fn f4() void {...@@ -24,8 +24,6 @@ export fn f4() void {
24}24}
2525
26// error26// error
27// backend=stage2
28// target=native
29//27//
30// :2:22: error: expected type 'usize', found 'void'28// :2:22: error: expected type 'usize', found 'void'
31// :7:9: error: expected type 'usize', found 'void'29// :7:9: error: expected type 'usize', found 'void'
test/cases/compile_errors/builtin_call_with_invalid_param.zig-2
...@@ -5,8 +5,6 @@ export fn builtinCallBoolFunctionInlineWithVoid() void {...@@ -5,8 +5,6 @@ export fn builtinCallBoolFunctionInlineWithVoid() void {
5fn boolFunction(_: bool) void {}5fn boolFunction(_: bool) void {}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:43: error: expected type 'bool', found 'void'9// :2:43: error: expected type 'bool', found 'void'
12// :5:20: note: parameter type declared here10// :5:20: note: parameter type declared here
test/cases/compile_errors/c_pointer_to_void.zig-2
...@@ -4,8 +4,6 @@ export fn entry() void {...@@ -4,8 +4,6 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:18: error: C pointers cannot point to non-C-ABI-compatible type 'void'8// :2:18: error: C pointers cannot point to non-C-ABI-compatible type 'void'
11// :2:18: note: 'void' is a zero bit type; for C 'void' use 'anyopaque'9// :2:18: note: 'void' is a zero bit type; for C 'void' use 'anyopaque'
test/cases/compile_errors/call_assigned_to_constant.zig-2
...@@ -17,8 +17,6 @@ export fn entry1() void {...@@ -17,8 +17,6 @@ export fn entry1() void {
17}17}
1818
19// error19// error
20// backend=stage2
21// target=native
22//20//
23// :12:5: error: cannot assign to constant21// :12:5: error: cannot assign to constant
24// :16:5: error: cannot assign to constant22// :16:5: error: cannot assign to constant
test/cases/compile_errors/call_from_double_ptr.zig-2
...@@ -7,8 +7,6 @@ export fn entry(a: **S) void {...@@ -7,8 +7,6 @@ export fn entry(a: **S) void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// 6:10: error: no field or member function named 'b' in '*tmp.S'11// 6:10: error: no field or member function named 'b' in '*tmp.S'
14// 6:10: note: method invocation only supports up to one level of implicit pointer dereferencing12// 6:10: note: method invocation only supports up to one level of implicit pointer dereferencing
test/cases/compile_errors/call_from_naked_func.zig-2
...@@ -17,8 +17,6 @@ export fn comptimeBuiltinCall() callconv(.naked) void {...@@ -17,8 +17,6 @@ export fn comptimeBuiltinCall() callconv(.naked) void {
17fn f() void {}17fn f() void {}
1818
19// error19// error
20// backend=stage2
21// target=native
22//20//
23// :2:6: error: runtime call not allowed in naked function21// :2:6: error: runtime call not allowed in naked function
24// :6:5: error: runtime @call not allowed in naked function22// :6:5: error: runtime @call not allowed in naked function
test/cases/compile_errors/call_optional_function.zig-2
...@@ -8,8 +8,6 @@ pub export fn entry2() void {...@@ -8,8 +8,6 @@ pub export fn entry2() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:9: error: cannot call optional type '?fn () void'12// :3:9: error: cannot call optional type '?fn () void'
15// :3:9: note: consider using '.?', 'orelse' or 'if'13// :3:9: note: consider using '.?', 'orelse' or 'if'
test/cases/compile_errors/callconv_from_global_variable.zig-2
...@@ -2,8 +2,6 @@ var cc: @import("std").builtin.CallingConvention = .c;...@@ -2,8 +2,6 @@ var cc: @import("std").builtin.CallingConvention = .c;
2export fn foo() callconv(cc) void {}2export fn foo() callconv(cc) void {}
33
4// error4// error
5// backend=stage2
6// target=native
7//5//
8// :2:26: error: unable to resolve comptime value6// :2:26: error: unable to resolve comptime value
9// :2:26: note: calling convention must be comptime-known7// :2:26: note: calling convention must be comptime-known
test/cases/compile_errors/callconv_interrupt_on_unsupported_platform.zig-1
...@@ -3,7 +3,6 @@ export fn entry2() callconv(.{ .x86_interrupt = .{} }) void {}...@@ -3,7 +3,6 @@ export fn entry2() callconv(.{ .x86_interrupt = .{} }) void {}
3export fn entry3() callconv(.avr_interrupt) void {}3export fn entry3() callconv(.avr_interrupt) void {}
44
5// error5// error
6// backend=stage2
7// target=aarch64-linux-none6// target=aarch64-linux-none
8//7//
9// :1:30: error: calling convention 'x86_64_interrupt' only available on architectures 'x86_64'8// :1:30: error: calling convention 'x86_64_interrupt' only available on architectures 'x86_64'
test/cases/compile_errors/callconv_signal_on_unsupported_platform.zig-1
...@@ -1,7 +1,6 @@...@@ -1,7 +1,6 @@
1export fn entry() callconv(.avr_signal) void {}1export fn entry() callconv(.avr_signal) void {}
22
3// error3// error
4// backend=stage2
5// target=x86_64-linux-none4// target=x86_64-linux-none
6//5//
7// :1:29: error: calling convention 'avr_signal' only available on architectures 'avr'6// :1:29: error: calling convention 'avr_signal' only available on architectures 'avr'
test/cases/compile_errors/callconv_stdcall_fastcall_thiscall_on_unsupported_platform.zig-1
...@@ -15,7 +15,6 @@ export fn entry3() void {...@@ -15,7 +15,6 @@ export fn entry3() void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=x86_64-linux-none18// target=x86_64-linux-none
20//19//
21// :1:28: error: calling convention 'x86_stdcall' only available on architectures 'x86'20// :1:28: error: calling convention 'x86_stdcall' only available on architectures 'x86'
test/cases/compile_errors/calling_function_with_naked_calling_convention.zig-2
...@@ -4,8 +4,6 @@ export fn entry() void {...@@ -4,8 +4,6 @@ export fn entry() void {
4fn foo() callconv(.naked) void {}4fn foo() callconv(.naked) void {}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:5: error: unable to call function with calling convention 'naked'8// :2:5: error: unable to call function with calling convention 'naked'
11// :4:1: note: function declared here9// :4:1: note: function declared here
test/cases/compile_errors/calling_var_args_extern_function_passing_array_instead_of_pointer.zig-2
...@@ -6,8 +6,6 @@ export fn entry() void {...@@ -6,8 +6,6 @@ export fn entry() void {
6pub extern fn foo(format: *const u8, ...) void;6pub extern fn foo(format: *const u8, ...) void;
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :3:16: error: expected type '*const u8', found '[5:0]u8'10// :3:16: error: expected type '*const u8', found '[5:0]u8'
13// :6:27: note: parameter type declared here11// :6:27: note: parameter type declared here
test/cases/compile_errors/cannot_break_out_of_defer_expression.zig-2
...@@ -7,8 +7,6 @@ export fn foo() void {...@@ -7,8 +7,6 @@ export fn foo() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :4:13: error: cannot break out of defer expression11// :4:13: error: cannot break out of defer expression
14// :3:9: note: defer expression here12// :3:9: note: defer expression here
test/cases/compile_errors/cannot_continue_out_of_defer_expression.zig-2
...@@ -7,8 +7,6 @@ export fn foo() void {...@@ -7,8 +7,6 @@ export fn foo() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :4:13: error: cannot continue out of defer expression11// :4:13: error: cannot continue out of defer expression
14// :3:9: note: defer expression here12// :3:9: note: defer expression here
test/cases/compile_errors/capture_by_ref_discard.zig-2
...@@ -17,8 +17,6 @@ export fn d() void {...@@ -17,8 +17,6 @@ export fn d() void {
17}17}
1818
19// error19// error
20// backend=stage2
21// target=native
22//20//
23// :2:16: error: pointer modifier invalid on discard21// :2:16: error: pointer modifier invalid on discard
24// :7:18: error: pointer modifier invalid on discard22// :7:18: error: pointer modifier invalid on discard
test/cases/compile_errors/capture_by_ref_if.zig-2
...@@ -3,8 +3,6 @@ test {...@@ -3,8 +3,6 @@ test {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:22: error: unused capture7// :2:22: error: unused capture
10// :2:38: error: unused capture8// :2:38: error: unused capture
test/cases/compile_errors/capture_by_ref_if_err_switch.zig-2
...@@ -4,7 +4,5 @@ test {...@@ -4,7 +4,5 @@ test {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:14: error: unused capture8// :3:14: error: unused capture
test/cases/compile_errors/capture_by_ref_switch.zig-2
...@@ -5,7 +5,5 @@ test {...@@ -5,7 +5,5 @@ test {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:17: error: unused capture9// :3:17: error: unused capture
test/cases/compile_errors/capture_by_ref_while.zig-2
...@@ -3,8 +3,6 @@ test {...@@ -3,8 +3,6 @@ test {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:25: error: unused capture7// :2:25: error: unused capture
10// :2:39: error: unused capture8// :2:39: error: unused capture
test/cases/compile_errors/cast_between_optional_T_where_T_is_not_a_pointer.zig-2
...@@ -16,8 +16,6 @@ export fn entry2() void {...@@ -16,8 +16,6 @@ export fn entry2() void {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :6:9: error: expected type '?*const fn (i8) void', found '?*const fn (u64) void'20// :6:9: error: expected type '?*const fn (i8) void', found '?*const fn (u64) void'
23// :6:9: note: pointer type child 'fn (u64) void' cannot cast into pointer type child 'fn (i8) void'21// :6:9: note: pointer type child 'fn (u64) void' cannot cast into pointer type child 'fn (i8) void'
test/cases/compile_errors/cast_enum_literal_to_enum_but_it_doesnt_match.zig-2
...@@ -8,8 +8,6 @@ export fn entry() void {...@@ -8,8 +8,6 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :6:21: error: enum 'tmp.Foo' has no member named 'c'12// :6:21: error: enum 'tmp.Foo' has no member named 'c'
15// :1:13: note: enum declared here13// :1:13: note: enum declared here
test/cases/compile_errors/cast_error_union_of_global_error_set_to_error_union_of_smaller_error_set.zig-2
...@@ -8,8 +8,6 @@ fn foo() anyerror!i32 {...@@ -8,8 +8,6 @@ fn foo() anyerror!i32 {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:37: error: expected type 'error{A}!i32', found 'anyerror!i32'12// :3:37: error: expected type 'error{A}!i32', found 'anyerror!i32'
15// :3:37: note: global error set cannot cast into a smaller set13// :3:37: note: global error set cannot cast into a smaller set
test/cases/compile_errors/cast_global_error_set_to_error_set.zig-2
...@@ -8,8 +8,6 @@ fn foo() anyerror {...@@ -8,8 +8,6 @@ fn foo() anyerror {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:33: error: expected type 'error{A}', found 'anyerror'12// :3:33: error: expected type 'error{A}', found 'anyerror'
15// :3:33: note: global error set cannot cast into a smaller set13// :3:33: note: global error set cannot cast into a smaller set
test/cases/compile_errors/cast_negative_integer_literal_to_usize.zig-2
...@@ -8,8 +8,6 @@ export fn entry1() void {...@@ -8,8 +8,6 @@ export fn entry1() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:26: error: type 'usize' cannot represent integer value '-10'12// :2:26: error: type 'usize' cannot represent integer value '-10'
15// :6:26: error: float value '-10' cannot be stored in integer type 'usize'13// :6:26: error: float value '-10' cannot be stored in integer type 'usize'
test/cases/compile_errors/cast_negative_value_to_unsigned_integer.zig-2
...@@ -10,8 +10,6 @@ export fn entry1() void {...@@ -10,8 +10,6 @@ export fn entry1() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :3:36: error: type 'u32' cannot represent integer value '-1'14// :3:36: error: type 'u32' cannot represent integer value '-1'
17// :8:27: error: type 'u32' cannot represent integer value '-1'15// :8:27: error: type 'u32' cannot represent integer value '-1'
test/cases/compile_errors/cast_unreachable.zig-2
...@@ -6,8 +6,6 @@ export fn entry() void {...@@ -6,8 +6,6 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:12: error: unreachable code10// :2:12: error: unreachable code
13// :2:21: note: control flow is diverted here11// :2:21: note: control flow is diverted here
test/cases/compile_errors/cast_without_result_type.zig-2
...@@ -19,8 +19,6 @@ export fn e() void {...@@ -19,8 +19,6 @@ export fn e() void {
19}19}
2020
21// error21// error
22// backend=stage2
23// target=native
24//22//
25// :2:9: error: @ptrFromInt must have a known result type23// :2:9: error: @ptrFromInt must have a known result type
26// :2:9: note: use @as to provide explicit result type24// :2:9: note: use @as to provide explicit result type
test/cases/compile_errors/cast_without_result_type_due_to_anyopaque_pointer.zig-2
...@@ -10,8 +10,6 @@ export fn bar() void {...@@ -10,8 +10,6 @@ export fn bar() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :2:34: error: @intCast must have a known result type14// :2:34: error: @intCast must have a known result type
17// :2:34: note: result type is unknown due to opaque pointer type15// :2:34: note: result type is unknown due to opaque pointer type
test/cases/compile_errors/cast_without_result_type_due_to_generic_parameter.zig-2
...@@ -19,8 +19,6 @@ export fn f() void {...@@ -19,8 +19,6 @@ export fn f() void {
19fn bar(_: anytype) void {}19fn bar(_: anytype) void {}
2020
21// error21// error
22// backend=stage2
23// target=native
24//22//
25// :2:9: error: @ptrFromInt must have a known result type23// :2:9: error: @ptrFromInt must have a known result type
26// :2:8: note: result type is unknown due to anytype parameter24// :2:8: note: result type is unknown due to anytype parameter
test/cases/compile_errors/casting_bit_offset_pointer_to_regular_pointer.zig-2
...@@ -17,8 +17,6 @@ export fn entry() usize {...@@ -17,8 +17,6 @@ export fn entry() usize {
17}17}
1818
19// error19// error
20// backend=stage2
21// target=native
22//20//
23// :8:16: error: expected type '*const u3', found '*align(1:3:1) const u3'21// :8:16: error: expected type '*const u3', found '*align(1:3:1) const u3'
24// :8:16: note: pointer host size '1' cannot cast into pointer host size '0'22// :8:16: note: pointer host size '1' cannot cast into pointer host size '0'
test/cases/compile_errors/chained_comparison_operators.zig-2
...@@ -3,7 +3,5 @@ export fn a(value: u32) bool {...@@ -3,7 +3,5 @@ export fn a(value: u32) bool {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:22: error: comparison operators cannot be chained7// :2:22: error: comparison operators cannot be chained
test/cases/compile_errors/cimport.zig-2
...@@ -7,8 +7,6 @@ const d = @cImport({...@@ -7,8 +7,6 @@ const d = @cImport({
7});7});
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :1:11: error: C define valid only inside C import block11// :1:11: error: C define valid only inside C import block
14// :3:17: error: C define valid only inside C import block12// :3:17: error: C define valid only inside C import block
test/cases/compile_errors/closure_get_in_param_ty_instantiate_incorrectly.zig-2
...@@ -18,8 +18,6 @@ pub export fn entry() void {...@@ -18,8 +18,6 @@ pub export fn entry() void {
18}18}
1919
20// error20// error
21// backend=stage2
22// target=native
23//21//
24// :17:25: error: expected type 'u32', found 'type'22// :17:25: error: expected type 'u32', found 'type'
25// :3:21: note: parameter type declared here23// :3:21: note: parameter type declared here
test/cases/compile_errors/coercion_to_error_union.zig-2
...@@ -4,8 +4,6 @@ export fn b() void {...@@ -4,8 +4,6 @@ export fn b() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// 2:28: error: expected type 'anyerror!u8', found 'comptime_int'8// 2:28: error: expected type 'anyerror!u8', found 'comptime_int'
11// 2:28: note: type 'u8' cannot represent value '256'9// 2:28: note: type 'u8' cannot represent value '256'
test/cases/compile_errors/coercion_to_optional.zig-2
...@@ -4,8 +4,6 @@ export fn a() void {...@@ -4,8 +4,6 @@ export fn a() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// 2:20: error: expected type '?u8', found 'comptime_int'8// 2:20: error: expected type '?u8', found 'comptime_int'
11// 2:20: note: type 'u8' cannot represent value '256'9// 2:20: note: type 'u8' cannot represent value '256'
test/cases/compile_errors/compare_optional_to_non_optional_with_incomparable_type.zig-2
...@@ -5,7 +5,5 @@ export fn entry() void {...@@ -5,7 +5,5 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :4:12: error: operator == not allowed for type '?[3]i32'9// :4:12: error: operator == not allowed for type '?[3]i32'
test/cases/compile_errors/comparing_a_non-optional_pointer_against_null.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:12: error: comparison of '*i32' with null8// :3:12: error: comparison of '*i32' with null
test/cases/compile_errors/comparison_of_non-tagged_union_and_enum_literal.zig created+12
...@@ -0,0 +1,12 @@
1export fn entry() void {
2 const U = union { A: u32, B: u64 };
3 var u = U{ .A = 42 };
4 var ok = u == .A;
5 _ = &u;
6 _ = &ok;
7}
8
9// error
10//
11// :4:14: error: comparison of union and enum literal is only valid for tagged union types
12// :2:15: note: union 'tmp.entry.U' is not a tagged union
test/cases/compile_errors/compileError_shows_traceback_of_references_that_caused_it.zig-2
...@@ -10,7 +10,5 @@ export fn entry() i32 {...@@ -10,7 +10,5 @@ export fn entry() i32 {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :1:13: error: aoeu14// :1:13: error: aoeu
test/cases/compile_errors/compileLog_of_tagged_enum_doesnt_crash_the_compiler.zig-2
...@@ -12,8 +12,6 @@ pub export fn entry() void {...@@ -12,8 +12,6 @@ pub export fn entry() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :6:5: error: found compile log statement16// :6:5: error: found compile log statement
19// :6:5: note: also here17// :6:5: note: also here
test/cases/compile_errors/compile_error_in_struct_init_expression.zig-2
...@@ -10,7 +10,5 @@ export fn entry() void {...@@ -10,7 +10,5 @@ export fn entry() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :2:14: error: use of undeclared identifier 'crap'14// :2:14: error: use of undeclared identifier 'crap'
test/cases/compile_errors/compile_error_when_evaluating_return_type_of_inferred_error_set.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:11: error: use of undeclared identifier 'SymbolThatDoesNotExist'12// :2:11: error: use of undeclared identifier 'SymbolThatDoesNotExist'
test/cases/compile_errors/compile_log.zig-2
...@@ -13,8 +13,6 @@ export fn baz() void {...@@ -13,8 +13,6 @@ export fn baz() void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :6:5: error: found compile log statement17// :6:5: error: found compile log statement
20// :6:5: note: also here18// :6:5: note: also here
test/cases/compile_errors/compile_log_statement_inside_function_which_must_be_comptime_evaluated.zig-2
...@@ -8,8 +8,6 @@ export fn entry() void {...@@ -8,8 +8,6 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:5: error: found compile log statement12// :2:5: error: found compile log statement
15//13//
test/cases/compile_errors/compile_log_statement_warning_deduplication_in_generic_fn.zig-2
...@@ -10,8 +10,6 @@ fn inner(comptime n: usize) void {...@@ -10,8 +10,6 @@ fn inner(comptime n: usize) void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :8:9: error: found compile log statement14// :8:9: error: found compile log statement
17// :8:9: note: also here15// :8:9: note: also here
test/cases/compile_errors/compile_time_null_ptr_cast.zig-2
...@@ -5,7 +5,5 @@ comptime {...@@ -5,7 +5,5 @@ comptime {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:32: error: null pointer casted to type '*i32'9// :3:32: error: null pointer casted to type '*i32'
test/cases/compile_errors/comptime_arg_to_generic_fn_callee_error.zig-2
...@@ -14,8 +14,6 @@ pub export fn entry() void {...@@ -14,8 +14,6 @@ pub export fn entry() void {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :7:28: error: enum 'meta.FieldEnum(tmp.MyStruct)' has no member named 'c'18// :7:28: error: enum 'meta.FieldEnum(tmp.MyStruct)' has no member named 'c'
21// :?:?: note: enum declared here19// :?:?: note: enum declared here
test/cases/compile_errors/comptime_cast_enum_to_union_but_field_has_payload.zig-2
...@@ -10,8 +10,6 @@ export fn entry() void {...@@ -10,8 +10,6 @@ export fn entry() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :8:26: error: coercion from enum 'tmp.Letter' to union 'tmp.Value' must initialize 'i32' field 'A'14// :8:26: error: coercion from enum 'tmp.Letter' to union 'tmp.Value' must initialize 'i32' field 'A'
17// :3:5: note: field 'A' declared here15// :3:5: note: field 'A' declared here
test/cases/compile_errors/comptime_continue_inside_runtime_catch.zig-2
...@@ -9,8 +9,6 @@ fn bad() !void {...@@ -9,8 +9,6 @@ fn bad() !void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :4:21: error: comptime control flow inside runtime block13// :4:21: error: comptime control flow inside runtime block
16// :4:15: note: runtime control flow here14// :4:15: note: runtime control flow here
test/cases/compile_errors/comptime_continue_inside_runtime_if_bool.zig-2
...@@ -9,8 +9,6 @@ export fn entry() void {...@@ -9,8 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :6:22: error: comptime control flow inside runtime block13// :6:22: error: comptime control flow inside runtime block
16// :6:15: note: runtime control flow here14// :6:15: note: runtime control flow here
test/cases/compile_errors/comptime_continue_inside_runtime_if_error.zig-2
...@@ -9,8 +9,6 @@ export fn entry() void {...@@ -9,8 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :6:20: error: comptime control flow inside runtime block13// :6:20: error: comptime control flow inside runtime block
16// :6:13: note: runtime control flow here14// :6:13: note: runtime control flow here
test/cases/compile_errors/comptime_continue_inside_runtime_if_optional.zig-2
...@@ -9,8 +9,6 @@ export fn entry() void {...@@ -9,8 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :6:20: error: comptime control flow inside runtime block13// :6:20: error: comptime control flow inside runtime block
16// :6:13: note: runtime control flow here14// :6:13: note: runtime control flow here
test/cases/compile_errors/comptime_continue_inside_runtime_orelse.zig-2
...@@ -9,8 +9,6 @@ fn bad() ?void {...@@ -9,8 +9,6 @@ fn bad() ?void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :4:22: error: comptime control flow inside runtime block13// :4:22: error: comptime control flow inside runtime block
16// :4:15: note: runtime control flow here14// :4:15: note: runtime control flow here
test/cases/compile_errors/comptime_continue_inside_runtime_switch.zig-2
...@@ -12,8 +12,6 @@ export fn entry() void {...@@ -12,8 +12,6 @@ export fn entry() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :7:19: error: comptime control flow inside runtime block16// :7:19: error: comptime control flow inside runtime block
19// :6:17: note: runtime control flow here17// :6:17: note: runtime control flow here
test/cases/compile_errors/comptime_continue_inside_runtime_while_bool.zig-2
...@@ -9,8 +9,6 @@ export fn entry() void {...@@ -9,8 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :6:25: error: comptime control flow inside runtime block13// :6:25: error: comptime control flow inside runtime block
16// :6:18: note: runtime control flow here14// :6:18: note: runtime control flow here
test/cases/compile_errors/comptime_continue_inside_runtime_while_error.zig-2
...@@ -11,8 +11,6 @@ export fn entry() void {...@@ -11,8 +11,6 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :7:13: error: comptime control flow inside runtime block15// :7:13: error: comptime control flow inside runtime block
18// :6:16: note: runtime control flow here16// :6:16: note: runtime control flow here
test/cases/compile_errors/comptime_continue_inside_runtime_while_optional.zig-2
...@@ -9,8 +9,6 @@ export fn entry() void {...@@ -9,8 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :6:23: error: comptime control flow inside runtime block13// :6:23: error: comptime control flow inside runtime block
16// :6:16: note: runtime control flow here14// :6:16: note: runtime control flow here
test/cases/compile_errors/comptime_continue_to_outer_inline_loop.zig-2
...@@ -15,8 +15,6 @@ pub export fn entry() void {...@@ -15,8 +15,6 @@ pub export fn entry() void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :10:30: error: comptime control flow inside runtime block19// :10:30: error: comptime control flow inside runtime block
22// :7:13: note: runtime control flow here20// :7:13: note: runtime control flow here
test/cases/compile_errors/comptime_if_inside_runtime_for.zig-2
...@@ -8,8 +8,6 @@ export fn entry() void {...@@ -8,8 +8,6 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :5:21: error: value with comptime-only type 'comptime_int' depends on runtime control flow12// :5:21: error: value with comptime-only type 'comptime_int' depends on runtime control flow
15// :4:10: note: runtime control flow here13// :4:10: note: runtime control flow here
test/cases/compile_errors/comptime_implicit_cast_f64_to_f32.zig-2
...@@ -5,7 +5,5 @@ export fn entry() void {...@@ -5,7 +5,5 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:20: error: type 'f32' cannot represent float value '16777217'9// :3:20: error: type 'f32' cannot represent float value '16777217'
test/cases/compile_errors/comptime_param_coersion.zig-2
...@@ -11,8 +11,6 @@ fn foo(comptime _: i32, comptime _: i32) void {}...@@ -11,8 +11,6 @@ fn foo(comptime _: i32, comptime _: i32) void {}
11fn bar(comptime _: i32, _: i32) void {}11fn bar(comptime _: i32, _: i32) void {}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :3:9: error: expected type 'fn (comptime i32, comptime i32) void', found 'fn (comptime i32, i32) void'15// :3:9: error: expected type 'fn (comptime i32, comptime i32) void', found 'fn (comptime i32, i32) void'
18// :3:9: note: non-comptime parameter 1 cannot cast into a comptime parameter16// :3:9: note: non-comptime parameter 1 cannot cast into a comptime parameter
test/cases/compile_errors/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig-2
...@@ -55,8 +55,6 @@ export fn foo_slice() void {...@@ -55,8 +55,6 @@ export fn foo_slice() void {
55}55}
5656
57// error57// error
58// backend=stage2
59// target=native
60//58//
61// :4:29: error: value in memory does not match slice sentinel59// :4:29: error: value in memory does not match slice sentinel
62// :4:29: note: expected '0', found '100'60// :4:29: note: expected '0', found '100'
test/cases/compile_errors/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig-2
...@@ -55,8 +55,6 @@ export fn foo_slice() void {...@@ -55,8 +55,6 @@ export fn foo_slice() void {
55}55}
5656
57// error57// error
58// backend=stage2
59// target=native
60//58//
61// :4:29: error: value in memory does not match slice sentinel59// :4:29: error: value in memory does not match slice sentinel
62// :4:29: note: expected '0', found '100'60// :4:29: note: expected '0', found '100'
test/cases/compile_errors/comptime_slice-sentinel_does_not_match_target-sentinel.zig-2
...@@ -70,8 +70,6 @@ export fn typeName_slice() void {...@@ -70,8 +70,6 @@ export fn typeName_slice() void {
70}70}
7171
72// error72// error
73// backend=stage2
74// target=native
75//73//
76// :4:29: error: value in memory does not match slice sentinel74// :4:29: error: value in memory does not match slice sentinel
77// :4:29: note: expected '255', found '0'75// :4:29: note: expected '255', found '0'
test/cases/compile_errors/comptime_slice-sentinel_is_out_of_bounds_terminated.zig-2
...@@ -55,8 +55,6 @@ export fn foo_slice() void {...@@ -55,8 +55,6 @@ export fn foo_slice() void {
55}55}
5656
57// error57// error
58// backend=stage2
59// target=native
60//58//
61// :4:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'59// :4:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'
62// :12:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'60// :12:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'
test/cases/compile_errors/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig-2
...@@ -55,8 +55,6 @@ export fn foo_slice() void {...@@ -55,8 +55,6 @@ export fn foo_slice() void {
55}55}
5656
57// error57// error
58// backend=stage2
59// target=native
60//58//
61// :4:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'59// :4:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'
62// :12:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'60// :12:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'
test/cases/compile_errors/comptime_slice_of_an_undefined_slice.zig-2
...@@ -5,7 +5,5 @@ comptime {...@@ -5,7 +5,5 @@ comptime {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:14: error: slice of undefined9// :3:14: error: slice of undefined
test/cases/compile_errors/comptime_slice_of_undefined_pointer_non-zero_len.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:41: error: non-zero length slice of undefined pointer8// :2:41: error: non-zero length slice of undefined pointer
test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig-2
...@@ -18,8 +18,6 @@ pub export fn entry() void {...@@ -18,8 +18,6 @@ pub export fn entry() void {
18}18}
1919
20// error20// error
21// backend=stage2
22// target=native
23//21//
24// :13:25: error: store to comptime variable depends on runtime condition22// :13:25: error: store to comptime variable depends on runtime condition
25// :11:16: note: runtime condition here23// :11:16: note: runtime condition here
test/cases/compile_errors/comptime_struct_field_no_init_value.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :2:5: error: comptime field without default initialization value11// :2:5: error: comptime field without default initialization value
test/cases/compile_errors/comptime_unreachable.zig-2
...@@ -3,7 +3,5 @@ pub export fn entry() void {...@@ -3,7 +3,5 @@ pub export fn entry() void {
3}3}
44
5// error5// error
6// target=native
7// backend=stage2
8//6//
9// :2:14: error: reached unreachable code7// :2:14: error: reached unreachable code
test/cases/compile_errors/const_is_a_statement_not_an_expression.zig-2
...@@ -3,7 +3,5 @@ export fn f() void {...@@ -3,7 +3,5 @@ export fn f() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:6: error: expected expression, found 'const'7// :2:6: error: expected expression, found 'const'
test/cases/compile_errors/container_init_with_non-type.zig-2
...@@ -6,7 +6,5 @@ export fn entry() usize {...@@ -6,7 +6,5 @@ export fn entry() usize {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:11: error: expected type 'type', found 'i32'10// :2:11: error: expected type 'type', found 'i32'
test/cases/compile_errors/control_flow_uses_comptime_var_at_runtime.zig-2
...@@ -29,8 +29,6 @@ export fn qux() void {...@@ -29,8 +29,6 @@ export fn qux() void {
29}29}
3030
31// error31// error
32// backend=stage2
33// target=native
34//32//
35// :3:24: error: cannot store to comptime variable in non-inline loop33// :3:24: error: cannot store to comptime variable in non-inline loop
36// :3:5: note: non-inline loop here34// :3:5: note: non-inline loop here
test/cases/compile_errors/decl_shadows_local.zig-2
...@@ -14,8 +14,6 @@ fn bar(a: usize) void {...@@ -14,8 +14,6 @@ fn bar(a: usize) void {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :3:15: error: declaration 'a' shadows function parameter from outer scope18// :3:15: error: declaration 'a' shadows function parameter from outer scope
21// :1:8: note: previous declaration here19// :1:8: note: previous declaration here
test/cases/compile_errors/declaration_between_fields.zig-2
...@@ -16,8 +16,6 @@ comptime {...@@ -16,8 +16,6 @@ comptime {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :9:5: error: declarations are not allowed between container fields20// :9:5: error: declarations are not allowed between container fields
23// :5:5: note: field before declarations here21// :5:5: note: field before declarations here
test/cases/compile_errors/declaration_with_same_name_as_primitive_must_use_special_syntax.zig-2
...@@ -5,8 +5,6 @@ export fn entry() void {...@@ -5,8 +5,6 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :1:7: error: name shadows primitive 'u8'9// :1:7: error: name shadows primitive 'u8'
12// :1:7: note: consider using @"u8" to disambiguate10// :1:7: note: consider using @"u8" to disambiguate
test/cases/compile_errors/deduplicate_undeclared_identifier.zig-2
...@@ -6,8 +6,6 @@ export fn b() void {...@@ -6,8 +6,6 @@ export fn b() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:5: error: use of undeclared identifier 'x'10// :2:5: error: use of undeclared identifier 'x'
13// :5:5: error: use of undeclared identifier 'x'11// :5:5: error: use of undeclared identifier 'x'
test/cases/compile_errors/deref_on_undefined_value.zig-2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:10: error: cannot dereference undefined value8// :3:10: error: cannot dereference undefined value
test/cases/compile_errors/deref_slice_and_get_len_field.zig-2
...@@ -5,7 +5,5 @@ export fn entry() void {...@@ -5,7 +5,5 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:10: error: index syntax required for slice type '[]u8'9// :3:10: error: index syntax required for slice type '[]u8'
test/cases/compile_errors/dereference_an_array.zig-2
...@@ -11,7 +11,5 @@ export fn entry() usize {...@@ -11,7 +11,5 @@ export fn entry() usize {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :5:10: error: cannot dereference non-pointer type '[10]u8'15// :5:10: error: cannot dereference non-pointer type '[10]u8'
test/cases/compile_errors/dereference_slice.zig-2
...@@ -6,7 +6,5 @@ comptime {...@@ -6,7 +6,5 @@ comptime {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:13: error: index syntax required for slice type '[]i32'10// :2:13: error: index syntax required for slice type '[]i32'
test/cases/compile_errors/dereference_unknown_length_pointer.zig-2
...@@ -3,7 +3,5 @@ export fn entry(x: [*]i32) i32 {...@@ -3,7 +3,5 @@ export fn entry(x: [*]i32) i32 {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:13: error: index syntax required for unknown-length pointer type '[*]i32'7// :2:13: error: index syntax required for unknown-length pointer type '[*]i32'
test/cases/compile_errors/dereferencing_invalid_payload_ptr_at_comptime.zig-2
...@@ -25,8 +25,6 @@ comptime {...@@ -25,8 +25,6 @@ comptime {
25}25}
2626
27// error27// error
28// backend=stage2
29// target=native
30//28//
31// :16:20: error: attempt to use null value29// :16:20: error: attempt to use null value
32// :24:20: error: attempt to unwrap error: Foo30// :24:20: error: attempt to unwrap error: Foo
test/cases/compile_errors/destructure_error_union.zig-2
...@@ -7,8 +7,6 @@ pub export fn entry() void {...@@ -7,8 +7,6 @@ pub export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :4:28: error: type 'anyerror!struct { u8, u8 }' cannot be destructured11// :4:28: error: type 'anyerror!struct { u8, u8 }' cannot be destructured
14// :4:26: note: result destructured here12// :4:26: note: result destructured here
test/cases/compile_errors/direct_struct_loop.zig-2
...@@ -6,7 +6,5 @@ export fn entry() usize {...@@ -6,7 +6,5 @@ export fn entry() usize {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :1:11: error: struct 'tmp.A' depends on itself10// :1:11: error: struct 'tmp.A' depends on itself
test/cases/compile_errors/directly_embedding_opaque_type_in_struct_and_union.zig-2
...@@ -25,8 +25,6 @@ export fn d() void {...@@ -25,8 +25,6 @@ export fn d() void {
25}25}
2626
27// error27// error
28// backend=stage2
29// target=native
30//28//
31// :3:8: error: opaque types have unknown size and therefore cannot be directly embedded in structs29// :3:8: error: opaque types have unknown size and therefore cannot be directly embedded in structs
32// :1:11: note: opaque declared here30// :1:11: note: opaque declared here
test/cases/compile_errors/disallow_coercion_from_non-null-terminated_pointer_to_null-terminated_pointer.zig-2
...@@ -6,8 +6,6 @@ pub export fn entry() void {...@@ -6,8 +6,6 @@ pub export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :5:14: error: expected type '[*:0]const u8', found '[*]const u8'10// :5:14: error: expected type '[*:0]const u8', found '[*]const u8'
13// :5:14: note: destination pointer requires '0' sentinel11// :5:14: note: destination pointer requires '0' sentinel
test/cases/compile_errors/discarded_array_bad_elem_type.zig-2
...@@ -6,7 +6,5 @@ export fn foo() void {...@@ -6,7 +6,5 @@ export fn foo() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :3:9: error: expected type 'u16', found '*const [5:0]u8'10// :3:9: error: expected type 'u16', found '*const [5:0]u8'
test/cases/compile_errors/discarding_error_value.zig-2
...@@ -10,8 +10,6 @@ export fn entry2() void {...@@ -10,8 +10,6 @@ export fn entry2() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :2:12: error: error union is discarded14// :2:12: error: error union is discarded
17// :2:12: note: consider using 'try', 'catch', or 'if'15// :2:12: note: consider using 'try', 'catch', or 'if'
test/cases/compile_errors/div_overflow.zig-2
...@@ -5,7 +5,5 @@ comptime {...@@ -5,7 +5,5 @@ comptime {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :4:11: error: overflow of integer type 'i8' with value '128'9// :4:11: error: overflow of integer type 'i8' with value '128'
test/cases/compile_errors/double_pointer_to_anyopaque_pointer.zig-2
...@@ -23,8 +23,6 @@ export fn entry4() void {...@@ -23,8 +23,6 @@ export fn entry4() void {
23}23}
2424
25// error25// error
26// backend=stage2
27// target=native
28//26//
29// :4:35: error: expected type '*const anyopaque', found '*const *const usize'27// :4:35: error: expected type '*const anyopaque', found '*const *const usize'
30// :4:35: note: cannot implicitly cast double pointer '*const *const usize' to anyopaque pointer '*const anyopaque'28// :4:35: note: cannot implicitly cast double pointer '*const *const usize' to anyopaque pointer '*const anyopaque'
test/cases/compile_errors/duplicate-unused_labels.zig-1
...@@ -29,7 +29,6 @@ comptime {...@@ -29,7 +29,6 @@ comptime {
29}29}
3030
31// error31// error
32// target=native
33//32//
34// :3:9: error: redefinition of label 'blk'33// :3:9: error: redefinition of label 'blk'
35// :2:5: note: previous definition here34// :2:5: note: previous definition here
test/cases/compile_errors/duplicate_boolean_switch_value.zig-2
...@@ -16,8 +16,6 @@ comptime {...@@ -16,8 +16,6 @@ comptime {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :5:9: error: duplicate switch value20// :5:9: error: duplicate switch value
23// :13:9: error: duplicate switch value21// :13:9: error: duplicate switch value
test/cases/compile_errors/duplicate_enum_field.zig-2
...@@ -9,8 +9,6 @@ export fn entry() void {...@@ -9,8 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :2:5: error: duplicate enum member name 'Bar'13// :2:5: error: duplicate enum member name 'Bar'
16// :3:5: note: duplicate name here14// :3:5: note: duplicate name here
test/cases/compile_errors/duplicate_error_in_switch.zig-2
...@@ -15,8 +15,6 @@ fn foo(x: i32) !void {...@@ -15,8 +15,6 @@ fn foo(x: i32) !void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :5:9: error: duplicate switch value19// :5:9: error: duplicate switch value
22// :3:9: note: previous value here20// :3:9: note: previous value here
test/cases/compile_errors/duplicate_error_value_in_error_set.zig-2
...@@ -8,8 +8,6 @@ export fn entry() void {...@@ -8,8 +8,6 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:5: error: duplicate error set field 'Bar'12// :3:5: error: duplicate error set field 'Bar'
15// :2:5: note: previous declaration here13// :2:5: note: previous declaration here
test/cases/compile_errors/duplicate_field_in_anonymous_struct_literal.zig-2
...@@ -11,8 +11,6 @@ export fn entry() void {...@@ -11,8 +11,6 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :4:14: error: duplicate struct field name15// :4:14: error: duplicate struct field name
18// :7:14: note: duplicate name here16// :7:14: note: duplicate name here
test/cases/compile_errors/duplicate_field_in_discarded_anon_init.zig-2
...@@ -3,8 +3,6 @@ pub export fn entry() void {...@@ -3,8 +3,6 @@ pub export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:13: error: duplicate struct field name7// :2:13: error: duplicate struct field name
10// :2:21: note: duplicate name here8// :2:21: note: duplicate name here
test/cases/compile_errors/duplicate_field_in_struct_value_expression.zig-2
...@@ -14,8 +14,6 @@ export fn f() void {...@@ -14,8 +14,6 @@ export fn f() void {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :8:10: error: duplicate struct field name18// :8:10: error: duplicate struct field name
21// :11:10: note: duplicate name here19// :11:10: note: duplicate name here
test/cases/compile_errors/duplicate_struct_field.zig-2
...@@ -21,8 +21,6 @@ export fn b() void {...@@ -21,8 +21,6 @@ export fn b() void {
21}21}
2222
23// error23// error
24// backend=stage2
25// target=native
26//24//
27// :2:5: error: duplicate struct member name 'Bar'25// :2:5: error: duplicate struct member name 'Bar'
28// :3:5: note: duplicate name here26// :3:5: note: duplicate name here
test/cases/compile_errors/embedFile_with_bogus_file.zig-2
...@@ -5,7 +5,5 @@ export fn entry() usize {...@@ -5,7 +5,5 @@ export fn entry() usize {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :1:29: error: unable to open 'bogus.txt': FileNotFound9// :1:29: error: unable to open 'bogus.txt': FileNotFound
test/cases/compile_errors/embed_outside_package.zig-1
...@@ -3,6 +3,5 @@ export fn a() usize {...@@ -3,6 +3,5 @@ export fn a() usize {
3}3}
44
5// error5// error
6// target=native
7//6//
8//:2:23: error: embed of file outside package path: '/root/foo'7//:2:23: error: embed of file outside package path: '/root/foo'
test/cases/compile_errors/empty_char_lit.zig-2
...@@ -3,7 +3,5 @@ export fn entry() u8 {...@@ -3,7 +3,5 @@ export fn entry() u8 {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:12: error: empty character literal7// :2:12: error: empty character literal
test/cases/compile_errors/empty_for_loop_body.zig-2
...@@ -3,7 +3,5 @@ export fn a() void {...@@ -3,7 +3,5 @@ export fn a() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:23: error: expected block or assignment, found ';'7// :2:23: error: expected block or assignment, found ';'
test/cases/compile_errors/empty_if_body.zig-2
...@@ -3,7 +3,5 @@ export fn a() void {...@@ -3,7 +3,5 @@ export fn a() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:13: error: expected block or assignment, found ';'7// :2:13: error: expected block or assignment, found ';'
test/cases/compile_errors/empty_switch_on_an_integer.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:5: error: switch must handle all possibilities8// :3:5: error: switch must handle all possibilities
test/cases/compile_errors/empty_while_loop_body.zig-2
...@@ -3,7 +3,5 @@ export fn a() void {...@@ -3,7 +3,5 @@ export fn a() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:16: error: expected block or assignment, found ';'7// :2:16: error: expected block or assignment, found ';'
test/cases/compile_errors/enumFromInt_on_non-exhaustive_enums_checks_int_in_range.zig-2
...@@ -4,8 +4,6 @@ pub export fn entry() void {...@@ -4,8 +4,6 @@ pub export fn entry() void {
4}4}
55
6// error6// error
7// target=native
8// backend=stage2
9//7//
10// :3:24: error: int value '100' out of range of non-exhaustive enum 'tmp.entry.E'8// :3:24: error: int value '100' out of range of non-exhaustive enum 'tmp.entry.E'
11// :2:15: note: enum declared here9// :2:15: note: enum declared here
test/cases/compile_errors/enum_backed_by_comptime_int_must_be_casted_from_comptime_value.zig-2
...@@ -7,8 +7,6 @@ export fn entry() void {...@@ -7,8 +7,6 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :6:31: error: unable to resolve comptime value11// :6:31: error: unable to resolve comptime value
14// :6:31: note: value casted to enum with 'comptime_int' tag type must be comptime-known12// :6:31: note: value casted to enum with 'comptime_int' tag type must be comptime-known
test/cases/compile_errors/enum_backed_by_comptime_int_must_be_comptime.zig-2
...@@ -5,7 +5,5 @@ pub export fn entry() void {...@@ -5,7 +5,5 @@ pub export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:12: error: variable of type 'tmp.entry.E' must be const or comptime9// :3:12: error: variable of type 'tmp.entry.E' must be const or comptime
test/cases/compile_errors/enum_field_value_references_enum.zig-2
...@@ -9,7 +9,5 @@ export fn entry() void {...@@ -9,7 +9,5 @@ export fn entry() void {
9const D = 1;9const D = 1;
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :1:5: error: dependency loop detected13// :1:5: error: dependency loop detected
test/cases/compile_errors/enum_in_field_count_range_but_not_matching_tag.zig-2
...@@ -8,8 +8,6 @@ export fn entry() void {...@@ -8,8 +8,6 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :6:20: error: enum 'tmp.Foo' has no tag with value '0'12// :6:20: error: enum 'tmp.Foo' has no tag with value '0'
15// :1:13: note: enum declared here13// :1:13: note: enum declared here
test/cases/compile_errors/enum_value_already_taken.zig-2
...@@ -11,8 +11,6 @@ export fn entry() void {...@@ -11,8 +11,6 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :6:9: error: enum tag value 60 already taken15// :6:9: error: enum tag value 60 already taken
18// :4:9: note: other occurrence here16// :4:9: note: other occurrence here
test/cases/compile_errors/enum_with_declarations_unavailable_for_reify_type.zig-2
...@@ -6,7 +6,5 @@ export fn entry() void {...@@ -6,7 +6,5 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:9: error: reified enums must have no decls10// :2:9: error: reified enums must have no decls
test/cases/compile_errors/error_in_call_builtin_args.zig-2
...@@ -8,8 +8,6 @@ pub export fn entry1() void {...@@ -8,8 +8,6 @@ pub export fn entry1() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:30: error: fractional component prevents float value '12.34' from coercion to type 'u32'12// :3:30: error: fractional component prevents float value '12.34' from coercion to type 'u32'
15// :7:23: error: fractional component prevents float value '12.34' from coercion to type 'u32'13// :7:23: error: fractional component prevents float value '12.34' from coercion to type 'u32'
test/cases/compile_errors/error_in_typeof_param.zig-2
...@@ -7,8 +7,6 @@ pub export fn entry() void {...@@ -7,8 +7,6 @@ pub export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :6:31: error: unable to resolve comptime value11// :6:31: error: unable to resolve comptime value
14// :6:31: note: value casted to 'comptime_int' must be comptime-known12// :6:31: note: value casted to 'comptime_int' must be comptime-known
test/cases/compile_errors/error_not_handled_in_switch.zig-2
...@@ -13,8 +13,6 @@ fn foo(x: i32) !void {...@@ -13,8 +13,6 @@ fn foo(x: i32) !void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :2:26: error: switch must handle all possibilities17// :2:26: error: switch must handle all possibilities
20// :2:26: note: unhandled error value: 'error.Bar'18// :2:26: note: unhandled error value: 'error.Bar'
test/cases/compile_errors/error_note_for_function_parameter_incompatibility.zig-2
...@@ -9,8 +9,6 @@ export fn entry() void {...@@ -9,8 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :8:18: error: expected type '*const fn (i32) void', found '*const fn (bool) void'13// :8:18: error: expected type '*const fn (i32) void', found '*const fn (bool) void'
16// :8:18: note: pointer type child 'fn (bool) void' cannot cast into pointer type child 'fn (i32) void'14// :8:18: note: pointer type child 'fn (bool) void' cannot cast into pointer type child 'fn (i32) void'
test/cases/compile_errors/error_set_cannot_capture_by_reference.zig-2
...@@ -9,7 +9,5 @@ export fn entry() void {...@@ -9,7 +9,5 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :5:23: error: error set cannot be captured by reference13// :5:23: error: error set cannot be captured by reference
test/cases/compile_errors/error_set_membership.zig-1
...@@ -24,7 +24,6 @@ pub fn main() Error!void {...@@ -24,7 +24,6 @@ pub fn main() Error!void {
24}24}
2525
26// error26// error
27// backend=stage2
28// target=x86_64-linux27// target=x86_64-linux
29//28//
30// :23:29: error: expected type 'error{InvalidCharacter}', found '@typeInfo(@typeInfo(@TypeOf(tmp.fooey)).@"fn".return_type.?).error_union.error_set'29// :23:29: error: expected type 'error{InvalidCharacter}', found '@typeInfo(@typeInfo(@TypeOf(tmp.fooey)).@"fn".return_type.?).error_union.error_set'
test/cases/compile_errors/error_union_operator_with_non_error_set_LHS.zig-2
...@@ -5,7 +5,5 @@ comptime {...@@ -5,7 +5,5 @@ comptime {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:15: error: expected error set type, found 'i32'9// :2:15: error: expected error set type, found 'i32'
test/cases/compile_errors/error_when_evaluating_return_type.zig-2
...@@ -11,7 +11,5 @@ export fn entry() void {...@@ -11,7 +11,5 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :2:19: error: expected type 'i32', found 'type'15// :2:19: error: expected type 'i32', found 'type'
test/cases/compile_errors/errors_in_for_loop_bodies_are_propagated.zig-2
...@@ -4,7 +4,5 @@ pub export fn entry() void {...@@ -4,7 +4,5 @@ pub export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:26: error: expected 1 argument, found 28// :3:26: error: expected 1 argument, found 2
test/cases/compile_errors/exact division failure.zig -2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:15: error: exact division produced remainder8// :2:15: error: exact division produced remainder
test/cases/compile_errors/exceeded_maximum_bit_width_of_integer.zig-2
...@@ -8,8 +8,6 @@ export fn entry2() void {...@@ -8,8 +8,6 @@ export fn entry2() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:15: error: primitive integer type 'u65536' exceeds maximum bit width of 6553512// :2:15: error: primitive integer type 'u65536' exceeds maximum bit width of 65535
15// :6:12: error: primitive integer type 'i65536' exceeds maximum bit width of 6553513// :6:12: error: primitive integer type 'i65536' exceeds maximum bit width of 65535
test/cases/compile_errors/expected_optional_type_got_container.zig-2
...@@ -9,8 +9,6 @@ fn bar() X {...@@ -9,8 +9,6 @@ fn bar() X {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :2:15: error: expected optional type, found 'tmp.X'13// :2:15: error: expected optional type, found 'tmp.X'
16// :6:11: note: enum declared here14// :6:11: note: enum declared here
test/cases/compile_errors/explicit_cast_float_literal_to_integer_when_there_is_a_fraction_component.zig-2
...@@ -3,7 +3,5 @@ export fn entry() i32 {...@@ -3,7 +3,5 @@ export fn entry() i32 {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:21: error: fractional component prevents float value '12.34' from coercion to type 'i32'7// :2:21: error: fractional component prevents float value '12.34' from coercion to type 'i32'
test/cases/compile_errors/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig-2
...@@ -7,7 +7,5 @@ comptime {...@@ -7,7 +7,5 @@ comptime {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :5:21: error: 'error.B' not a member of error set 'error{A,C}'11// :5:21: error: 'error.B' not a member of error set 'error{A,C}'
test/cases/compile_errors/explicitly_casting_non_tag_type_to_enum.zig-2
...@@ -12,7 +12,5 @@ export fn entry() void {...@@ -12,7 +12,5 @@ export fn entry() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :10:39: error: expected integer type, found 'f32'16// :10:39: error: expected integer type, found 'f32'
test/cases/compile_errors/export_with_empty_name_string.zig-2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:25: error: exported symbol name cannot be empty8// :3:25: error: exported symbol name cannot be empty
test/cases/compile_errors/exported_enum_without_explicit_integer_tag_type.zig-2
...@@ -8,8 +8,6 @@ comptime {...@@ -8,8 +8,6 @@ comptime {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:5: error: unable to export type 'type'12// :3:5: error: unable to export type 'type'
15// :7:5: error: unable to export type 'tmp.E'13// :7:5: error: unable to export type 'tmp.E'
test/cases/compile_errors/exported_function_uses_invalid_type.zig-1
...@@ -8,6 +8,5 @@ export fn foo() void {...@@ -8,6 +8,5 @@ export fn foo() void {
8// the original bug leading to this test occurred only with the LLVM backend.8// the original bug leading to this test occurred only with the LLVM backend.
99
10// error10// error
11// backend=stage2,llvm
12//11//
13// :2:33: error: expected type 'u32', found '*const [11:0]u8'12// :2:33: error: expected type 'u32', found '*const [11:0]u8'
test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig-2
...@@ -7,8 +7,6 @@ export fn entry() void {...@@ -7,8 +7,6 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :2:8: error: extern structs cannot contain fields of type '*const fn () void'11// :2:8: error: extern structs cannot contain fields of type '*const fn () void'
14// :2:8: note: extern function must specify calling convention12// :2:8: note: extern function must specify calling convention
test/cases/compile_errors/extern_packed_on_opaque.zig-2
...@@ -7,8 +7,6 @@ export fn foo(x: *X, y: *Y) void {...@@ -7,8 +7,6 @@ export fn foo(x: *X, y: *Y) void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :1:11: error: opaque types do not support 'packed' or 'extern'11// :1:11: error: opaque types do not support 'packed' or 'extern'
14// :2:11: error: opaque types do not support 'packed' or 'extern'12// :2:11: error: opaque types do not support 'packed' or 'extern'
test/cases/compile_errors/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig-2
...@@ -38,8 +38,6 @@ export fn entry() void {...@@ -38,8 +38,6 @@ export fn entry() void {
38}38}
3939
40// error40// error
41// backend=stage2
42// target=native
43//41//
44// :33:8: error: extern structs cannot contain fields of type 'tmp.E'42// :33:8: error: extern structs cannot contain fields of type 'tmp.E'
45// :33:8: note: enum tag type 'u9' is not extern compatible43// :33:8: note: enum tag type 'u9' is not extern compatible
test/cases/compile_errors/extern_struct_with_non-extern-compatible_integer_tag_type.zig-2
...@@ -8,8 +8,6 @@ export fn entry() void {...@@ -8,8 +8,6 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:8: error: extern structs cannot contain fields of type 'tmp.E'12// :3:8: error: extern structs cannot contain fields of type 'tmp.E'
15// :3:8: note: enum tag type 'u31' is not extern compatible13// :3:8: note: enum tag type 'u31' is not extern compatible
test/cases/compile_errors/extern_union_field_missing_type.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :2:5: error: union field missing type11// :2:5: error: union field missing type
test/cases/compile_errors/extern_union_given_enum_tag_type.zig-2
...@@ -14,7 +14,5 @@ export fn entry() void {...@@ -14,7 +14,5 @@ export fn entry() void {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :6:30: error: extern union does not support enum tag type18// :6:30: error: extern union does not support enum tag type
test/cases/compile_errors/extern_variable_has_no_type.zig-2
...@@ -4,7 +4,5 @@ pub export fn entry() void {...@@ -4,7 +4,5 @@ pub export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:8: error: unable to infer variable type8// :1:8: error: unable to infer variable type
test/cases/compile_errors/extern_variable_has_non_extern_type.zig-2
...@@ -4,8 +4,6 @@ pub export fn entry() void {...@@ -4,8 +4,6 @@ pub export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:17: error: extern variable cannot have type 'u3'8// :1:17: error: extern variable cannot have type 'u3'
11// :1:17: note: only integers with 0 or power of two bits are extern compatible9// :1:17: note: only integers with 0 or power of two bits are extern compatible
test/cases/compile_errors/extra_comma_in_destructure.zig-2
...@@ -4,7 +4,5 @@ export fn foo() void {...@@ -4,7 +4,5 @@ export fn foo() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:23: error: expected expression or var decl, found '='8// :2:23: error: expected expression or var decl, found '='
test/cases/compile_errors/fieldParentPtr-bad_field_name.zig-2
...@@ -6,8 +6,6 @@ export fn foo(a: *i32) *Foo {...@@ -6,8 +6,6 @@ export fn foo(a: *i32) *Foo {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :5:28: error: no field named 'a' in struct 'tmp.Foo'10// :5:28: error: no field named 'a' in struct 'tmp.Foo'
13// :1:20: note: struct declared here11// :1:20: note: struct declared here
test/cases/compile_errors/fieldParentPtr-comptime_field_ptr_not_based_on_struct.zig-2
...@@ -14,7 +14,5 @@ comptime {...@@ -14,7 +14,5 @@ comptime {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :12:62: error: pointer value not based on parent struct18// :12:62: error: pointer value not based on parent struct
test/cases/compile_errors/fieldParentPtr-comptime_wrong_field_index.zig-2
...@@ -13,8 +13,6 @@ comptime {...@@ -13,8 +13,6 @@ comptime {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :11:41: error: field 'b' has index '1' but pointer value is index '0' of struct 'tmp.Foo'17// :11:41: error: field 'b' has index '1' but pointer value is index '0' of struct 'tmp.Foo'
20// :1:13: note: struct declared here18// :1:13: note: struct declared here
test/cases/compile_errors/fieldParentPtr-field_pointer_is_not_pointer.zig-2
...@@ -6,7 +6,5 @@ export fn foo(a: i32) *const Foo {...@@ -6,7 +6,5 @@ export fn foo(a: i32) *const Foo {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :5:33: error: expected pointer type, found 'i32'10// :5:33: error: expected pointer type, found 'i32'
test/cases/compile_errors/fieldParentPtr-non_pointer.zig-2
...@@ -4,7 +4,5 @@ export fn foo(a: *i32) Foo {...@@ -4,7 +4,5 @@ export fn foo(a: *i32) Foo {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:12: error: expected pointer type, found 'i32'8// :3:12: error: expected pointer type, found 'i32'
test/cases/compile_errors/fieldParentPtr_on_comptime_field.zig-2
...@@ -9,8 +9,6 @@ pub export fn entry2() void {...@@ -9,8 +9,6 @@ pub export fn entry2() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :5:5: error: no offset available for comptime field13// :5:5: error: no offset available for comptime field
16// :8:29: error: cannot get @fieldParentPtr of a comptime field14// :8:29: error: cannot get @fieldParentPtr of a comptime field
test/cases/compile_errors/field_access_of_opaque_type.zig-2
...@@ -10,7 +10,5 @@ fn bar(x: *MyType) bool {...@@ -10,7 +10,5 @@ fn bar(x: *MyType) bool {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :9:13: error: type '*tmp.MyType' does not support field access14// :9:13: error: type '*tmp.MyType' does not support field access
test/cases/compile_errors/field_access_of_slices.zig-2
...@@ -6,8 +6,6 @@ export fn entry() void {...@@ -6,8 +6,6 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :4:32: error: type '[]i32' has no members10// :4:32: error: type '[]i32' has no members
13// :4:32: note: slice values have 'len' and 'ptr' members11// :4:32: note: slice values have 'len' and 'ptr' members
test/cases/compile_errors/field_access_of_unknown_length_pointer.zig-2
...@@ -7,7 +7,5 @@ export fn entry(foo: [*]Foo) void {...@@ -7,7 +7,5 @@ export fn entry(foo: [*]Foo) void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :6:8: error: type '[*]tmp.Foo' does not support field access11// :6:8: error: type '[*]tmp.Foo' does not support field access
test/cases/compile_errors/field_access_of_wrapped_type.zig-2
...@@ -11,8 +11,6 @@ export fn f2() void {...@@ -11,8 +11,6 @@ export fn f2() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :6:8: error: optional type '?tmp.Foo' does not support field access15// :6:8: error: optional type '?tmp.Foo' does not support field access
18// :6:8: note: consider using '.?', 'orelse', or 'if'16// :6:8: note: consider using '.?', 'orelse', or 'if'
test/cases/compile_errors/field_type_supplied_in_an_enum.zig-2
...@@ -5,8 +5,6 @@ const Letter = enum {...@@ -5,8 +5,6 @@ const Letter = enum {
5};5};
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:8: error: enum fields do not have types9// :2:8: error: enum fields do not have types
12// :1:16: note: consider 'union(enum)' here to make it a tagged union10// :1:16: note: consider 'union(enum)' here to make it a tagged union
test/cases/compile_errors/file_level_struct_invalid_field_type.zig-2
...@@ -11,7 +11,5 @@ comptime {...@@ -11,7 +11,5 @@ comptime {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :7:15: error: expected type 'type', found 'fn () type'15// :7:15: error: expected type 'type', found 'fn () type'
test/cases/compile_errors/float exact division failure.zig -2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:15: error: exact division produced remainder8// :2:15: error: exact division produced remainder
test/cases/compile_errors/for_discard_unbounded.zig-2
...@@ -4,7 +4,5 @@ export fn a() void {...@@ -4,7 +4,5 @@ export fn a() void {
4 }4 }
5}5}
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:27: error: discard of unbounded counter8// :2:27: error: discard of unbounded counter
test/cases/compile_errors/for_empty.zig-2
...@@ -5,7 +5,5 @@ export fn b() void {...@@ -5,7 +5,5 @@ export fn b() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:10: error: expected expression, found ')'9// :2:10: error: expected expression, found ')'
test/cases/compile_errors/for_extra_capture.zig-2
...@@ -8,7 +8,5 @@ export fn b() void {...@@ -8,7 +8,5 @@ export fn b() void {
8// zig fmt: on8// zig fmt: on
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:21: error: extra capture in for loop12// :3:21: error: extra capture in for loop
test/cases/compile_errors/for_extra_condition.zig-2
...@@ -5,7 +5,5 @@ export fn a() void {...@@ -5,7 +5,5 @@ export fn a() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:19: error: for input is not captured9// :2:19: error: for input is not captured
test/cases/compile_errors/for_invalid_ranges.zig-2
...@@ -25,8 +25,6 @@ export fn e() void {...@@ -25,8 +25,6 @@ export fn e() void {
25}25}
2626
27// error27// error
28// backend=stage2
29// target=native
30//28//
31// :2:13: error: expected type 'usize', found '*const [5:0]u8'29// :2:13: error: expected type 'usize', found '*const [5:0]u8'
32// :7:10: error: type 'usize' cannot represent integer value '-1'30// :7:10: error: type 'usize' cannot represent integer value '-1'
test/cases/compile_errors/for_loop_body_expression_ignored.zig-2
...@@ -18,8 +18,6 @@ export fn f4() void {...@@ -18,8 +18,6 @@ export fn f4() void {
18}18}
1919
20// error20// error
21// backend=stage2
22// target=native
23//21//
24// :5:30: error: value of type 'usize' ignored22// :5:30: error: value of type 'usize' ignored
25// :5:30: note: all non-void values must be used23// :5:30: note: all non-void values must be used
test/cases/compile_errors/for_loop_break_value_ignored.zig-2
...@@ -9,8 +9,6 @@ export fn f1() void {...@@ -9,8 +9,6 @@ export fn f1() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :6:5: error: incompatible types: 'usize' and 'void'13// :6:5: error: incompatible types: 'usize' and 'void'
16// :7:22: note: type 'usize' here14// :7:22: note: type 'usize' here
test/cases/compile_errors/for_loop_error_union.zig-2
...@@ -7,8 +7,6 @@ export fn a() void {...@@ -7,8 +7,6 @@ export fn a() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :6:11: error: type '@typeInfo(@typeInfo(@TypeOf(tmp.b)).@"fn".return_type.?).error_union.error_set!u32' is not indexable and not a range11// :6:11: error: type '@typeInfo(@typeInfo(@TypeOf(tmp.b)).@"fn".return_type.?).error_union.error_set!u32' is not indexable and not a range
14// :6:11: note: for loop operand must be a range, array, slice, tuple, or vector12// :6:11: note: for loop operand must be a range, array, slice, tuple, or vector
test/cases/compile_errors/for_unbounded.zig-2
...@@ -5,7 +5,5 @@ export fn b() void {...@@ -5,7 +5,5 @@ export fn b() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:5: error: unbounded for loop9// :2:5: error: unbounded for loop
test/cases/compile_errors/function-only_builtins_outside_function.zig-2
...@@ -47,8 +47,6 @@ comptime {...@@ -47,8 +47,6 @@ comptime {
47}47}
4848
49// error49// error
50// backend=stage2
51// target=native
52//50//
53// :2:5: error: '@branchHint' outside function scope51// :2:5: error: '@branchHint' outside function scope
54// :6:5: error: '@src' outside function scope52// :6:5: error: '@src' outside function scope
test/cases/compile_errors/function_alignment_non_power_of_2.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:23: error: alignment value '3' is not a power of two8// :1:23: error: alignment value '3' is not a power of two
test/cases/compile_errors/function_alignment_on_unsupported_target.zig-1
...@@ -1,7 +1,6 @@...@@ -1,7 +1,6 @@
1export fn entry() align(64) void {}1export fn entry() align(64) void {}
22
3// error3// error
4// backend=stage2
5// target=nvptx-cuda,nvptx64-cuda,spirv32-opengl,spirv32-vulkan,spirv32-opencl,spirv64-opencl,spirv64-amdhsa,wasm32-freestanding,wasm64-freestanding4// target=nvptx-cuda,nvptx64-cuda,spirv32-opengl,spirv32-vulkan,spirv32-opencl,spirv64-opencl,spirv64-amdhsa,wasm32-freestanding,wasm64-freestanding
6//5//
7// :1:25: error: target does not support function alignment6// :1:25: error: target does not support function alignment
test/cases/compile_errors/function_call_assigned_to_incorrect_type.zig-2
...@@ -7,8 +7,6 @@ fn concat() [16]f32 {...@@ -7,8 +7,6 @@ fn concat() [16]f32 {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :3:17: error: expected type '[4]f32', found '[16]f32'11// :3:17: error: expected type '[4]f32', found '[16]f32'
14// :3:17: note: destination has length 412// :3:17: note: destination has length 4
test/cases/compile_errors/function_parameter_is_opaque.zig-2
...@@ -12,8 +12,6 @@ export fn entry3() void {...@@ -12,8 +12,6 @@ export fn entry3() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :3:28: error: parameter of opaque type 'tmp.FooType' not allowed16// :3:28: error: parameter of opaque type 'tmp.FooType' not allowed
19// :1:17: note: opaque declared here17// :1:17: note: opaque declared here
test/cases/compile_errors/function_prototype_with_no_body.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:1: error: non-extern function has no body8// :1:1: error: non-extern function has no body
test/cases/compile_errors/function_ptr_alignment.zig-1
...@@ -9,7 +9,6 @@ comptime {...@@ -9,7 +9,6 @@ comptime {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=x86_64-linux12// target=x86_64-linux
14//13//
15// :8:41: error: expected type '*align(2) const fn () void', found '*const fn () void'14// :8:41: error: expected type '*align(2) const fn () void', found '*const fn () void'
test/cases/compile_errors/function_returning_opaque_type.zig-2
...@@ -4,8 +4,6 @@ export fn bar() FooType {...@@ -4,8 +4,6 @@ export fn bar() FooType {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:17: error: opaque return type 'tmp.FooType' not allowed8// :2:17: error: opaque return type 'tmp.FooType' not allowed
11// :1:17: note: opaque declared here9// :1:17: note: opaque declared here
test/cases/compile_errors/function_type_coercion.zig-2
...@@ -10,8 +10,6 @@ export fn wrong_return_type() void {...@@ -10,8 +10,6 @@ export fn wrong_return_type() void {
10}10}
1111
12// error12// error
13// backend=stage2,llvm
14// target=native
15//13//
16// :3:25: error: expected type 'fn () void', found 'fn (i32) void'14// :3:25: error: expected type 'fn () void', found 'fn (i32) void'
17// :3:25: note: function with 1 parameters cannot cast into a function with 0 parameters15// :3:25: note: function with 1 parameters cannot cast into a function with 0 parameters
test/cases/compile_errors/function_type_named.zig-2
...@@ -1,7 +1,5 @@...@@ -1,7 +1,5 @@
1const aFunc = fn someFunc(x: i32) void;1const aFunc = fn someFunc(x: i32) void;
22
3// error3// error
4// backend=stage2
5// target=native
6//4//
7// :1:18: error: function type cannot have a name5// :1:18: error: function type cannot have a name
test/cases/compile_errors/function_with_invalid_return_type.zig-2
...@@ -1,7 +1,5 @@...@@ -1,7 +1,5 @@
1export fn foo() boid {}1export fn foo() boid {}
22
3// error3// error
4// backend=stage2
5// target=native
6//4//
7// :1:17: error: use of undeclared identifier 'boid'5// :1:17: error: use of undeclared identifier 'boid'
test/cases/compile_errors/generic_function_call_assigned_to_incorrect_type.zig-2
...@@ -7,7 +7,5 @@ fn myAlloc(comptime arg: type) anyerror!arg {...@@ -7,7 +7,5 @@ fn myAlloc(comptime arg: type) anyerror!arg {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :3:18: error: expected type '[]i32', found 'anyerror!i32'11// :3:18: error: expected type '[]i32', found 'anyerror!i32'
test/cases/compile_errors/generic_function_returning_opaque_type.zig created+16
...@@ -0,0 +1,16 @@
1fn generic(comptime T: type) T {
2 return undefined;
3}
4const MyOpaque = opaque {};
5export fn foo() void {
6 _ = generic(MyOpaque);
7}
8export fn bar() void {
9 _ = generic(anyopaque);
10}
11
12// error
13//
14// :1:30: error: opaque return type 'tmp.MyOpaque' not allowed
15// :4:18: note: opaque declared here
16// :1:30: error: opaque return type 'anyopaque' not allowed
test/cases/compile_errors/generic_instantiation_failure.zig-2
...@@ -19,8 +19,6 @@ pub export fn entry() void {...@@ -19,8 +19,6 @@ pub export fn entry() void {
19}19}
2020
21// error21// error
22// backend=stage2
23// target=native
24//22//
25// :18:43: error: value of type 'type' ignored23// :18:43: error: value of type 'type' ignored
26// :18:43: note: all non-void values must be used24// :18:43: note: all non-void values must be used
test/cases/compile_errors/global_var_struct_init_in_comptime_block.zig-2
...@@ -7,8 +7,6 @@ comptime {...@@ -7,8 +7,6 @@ comptime {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :6:17: error: unable to evaluate comptime expression11// :6:17: error: unable to evaluate comptime expression
14// :6:17: note: operation is runtime due to this operand12// :6:17: note: operation is runtime due to this operand
test/cases/compile_errors/global_variable_alignment_non_power_of_2.zig-2
...@@ -4,7 +4,5 @@ export fn entry() usize {...@@ -4,7 +4,5 @@ export fn entry() usize {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:32: error: alignment value '3' is not a power of two8// :1:32: error: alignment value '3' is not a power of two
test/cases/compile_errors/hasDecl_with_non-container.zig-2
...@@ -3,7 +3,5 @@ export fn entry() void {...@@ -3,7 +3,5 @@ export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:18: error: expected struct, enum, union, or opaque; found 'i32'7// :2:18: error: expected struct, enum, union, or opaque; found 'i32'
test/cases/compile_errors/helpful_return_type_error_message.zig-2
...@@ -16,8 +16,6 @@ export fn quux() u32 {...@@ -16,8 +16,6 @@ export fn quux() u32 {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :2:18: error: expected type 'u32', found 'error{Ohno}'20// :2:18: error: expected type 'u32', found 'error{Ohno}'
23// :1:17: note: function cannot return an error21// :1:17: note: function cannot return an error
test/cases/compile_errors/if_condition_is_bool_not_int.zig-2
...@@ -7,8 +7,6 @@ export fn bar() void {...@@ -7,8 +7,6 @@ export fn bar() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :2:9: error: expected type 'bool', found 'comptime_int'11// :2:9: error: expected type 'bool', found 'comptime_int'
14// :6:18: error: expected type 'bool', found 'comptime_int'12// :6:18: error: expected type 'bool', found 'comptime_int'
test/cases/compile_errors/ignored_assert-err-ok_return_value.zig-2
...@@ -6,8 +6,6 @@ fn bar() anyerror!i32 {...@@ -6,8 +6,6 @@ fn bar() anyerror!i32 {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:11: error: value of type 'i32' ignored10// :2:11: error: value of type 'i32' ignored
13// :2:11: note: all non-void values must be used11// :2:11: note: all non-void values must be used
test/cases/compile_errors/ignored_comptime_statement_value.zig-2
...@@ -5,8 +5,6 @@ export fn foo() void {...@@ -5,8 +5,6 @@ export fn foo() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:9: error: value of type 'comptime_int' ignored9// :3:9: error: value of type 'comptime_int' ignored
12// :3:9: note: all non-void values must be used10// :3:9: note: all non-void values must be used
test/cases/compile_errors/ignored_comptime_value.zig-2
...@@ -9,8 +9,6 @@ fn bar() u8 {...@@ -9,8 +9,6 @@ fn bar() u8 {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :2:5: error: value of type 'comptime_int' ignored13// :2:5: error: value of type 'comptime_int' ignored
16// :2:5: note: all non-void values must be used14// :2:5: note: all non-void values must be used
test/cases/compile_errors/ignored_deferred_function_call.zig-2
...@@ -13,8 +13,6 @@ fn bar2() anyerror {...@@ -13,8 +13,6 @@ fn bar2() anyerror {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :2:14: error: error union is ignored17// :2:14: error: error union is ignored
20// :2:14: note: consider using 'try', 'catch', or 'if'18// :2:14: note: consider using 'try', 'catch', or 'if'
test/cases/compile_errors/ignored_deferred_statement_value.zig-2
...@@ -5,8 +5,6 @@ export fn foo() void {...@@ -5,8 +5,6 @@ export fn foo() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:9: error: value of type 'comptime_int' ignored9// :3:9: error: value of type 'comptime_int' ignored
12// :3:9: note: all non-void values must be used10// :3:9: note: all non-void values must be used
test/cases/compile_errors/ignored_expression_in_while_continuation.zig-2
...@@ -23,8 +23,6 @@ fn bad2() anyerror {...@@ -23,8 +23,6 @@ fn bad2() anyerror {
23}23}
2424
25// error25// error
26// backend=stage2
27// target=native
28//26//
29// :2:24: error: error union is ignored27// :2:24: error: error union is ignored
30// :2:24: note: consider using 'try', 'catch', or 'if'28// :2:24: note: consider using 'try', 'catch', or 'if'
test/cases/compile_errors/ignored_return_value.zig-2
...@@ -6,8 +6,6 @@ fn bar() i32 {...@@ -6,8 +6,6 @@ fn bar() i32 {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:8: error: value of type 'i32' ignored10// :2:8: error: value of type 'i32' ignored
13// :2:8: note: all non-void values must be used11// :2:8: note: all non-void values must be used
test/cases/compile_errors/ignored_statement_value.zig-2
...@@ -3,8 +3,6 @@ export fn foo() void {...@@ -3,8 +3,6 @@ export fn foo() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:5: error: value of type 'comptime_int' ignored7// :2:5: error: value of type 'comptime_int' ignored
10// :2:5: note: all non-void values must be used8// :2:5: note: all non-void values must be used
test/cases/compile_errors/illegal_comparison_of_types.zig-2
...@@ -17,8 +17,6 @@ export fn entry2() usize {...@@ -17,8 +17,6 @@ export fn entry2() usize {
17}17}
1818
19// error19// error
20// backend=stage2
21// target=native
22//20//
23// :2:14: error: operator == not allowed for type '[]u8'21// :2:14: error: operator == not allowed for type '[]u8'
24// :9:16: error: operator == not allowed for type 'tmp.EnumWithData'22// :9:16: error: operator == not allowed for type 'tmp.EnumWithData'
test/cases/compile_errors/illegal_operation_on_logical_ptr.zig-1
...@@ -35,7 +35,6 @@ export fn ptrIntArithmetic() void {...@@ -35,7 +35,6 @@ export fn ptrIntArithmetic() void {
35}35}
3636
37// error37// error
38// backend=stage2
39// target=spirv64-vulkan38// target=spirv64-vulkan
40//39//
41// :3:8: error: illegal operation on logical pointer of type '[*]u8'40// :3:8: error: illegal operation on logical pointer of type '[*]u8'
test/cases/compile_errors/implicit_array_ptr_cast_sentinel_mismatch.zig-2
...@@ -12,8 +12,6 @@ pub export fn entry1() void {...@@ -12,8 +12,6 @@ pub export fn entry1() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :2:12: error: expected type '[:255]const u8', found '*const [4:0]u8'16// :2:12: error: expected type '[:255]const u8', found '*const [4:0]u8'
19// :2:12: note: pointer sentinel '0' cannot cast into pointer sentinel '255'17// :2:12: note: pointer sentinel '0' cannot cast into pointer sentinel '255'
test/cases/compile_errors/implicit_cast_between_C_pointer_and_Zig_pointer-bad_const-align-child.zig-2
...@@ -30,8 +30,6 @@ export fn f() void {...@@ -30,8 +30,6 @@ export fn f() void {
30}30}
3131
32// error32// error
33// backend=stage2
34// target=native
35//33//
36// :3:27: error: expected type '*align(4) u8', found '[*c]u8'34// :3:27: error: expected type '*align(4) u8', found '[*c]u8'
37// :3:27: note: pointer alignment '1' cannot cast into pointer alignment '4'35// :3:27: note: pointer alignment '1' cannot cast into pointer alignment '4'
test/cases/compile_errors/implicit_cast_const_array_to_mutable_slice.zig-2
...@@ -20,8 +20,6 @@ export fn entry3() void {...@@ -20,8 +20,6 @@ export fn entry3() void {
20}20}
2121
22// error22// error
23// backend=stage2
24// target=native
25//23//
26// :3:26: error: expected type '[]u8', found '*const [1]u8'24// :3:26: error: expected type '[]u8', found '*const [1]u8'
27// :3:26: note: cast discards const qualifier25// :3:26: note: cast discards const qualifier
test/cases/compile_errors/implicit_cast_from_array_to_mutable_slice.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :6:9: error: array literal requires address-of operator (&) to coerce to slice type '[]i32'11// :6:9: error: array literal requires address-of operator (&) to coerce to slice type '[]i32'
test/cases/compile_errors/implicit_cast_from_f64_to_f32.zig-2
...@@ -11,8 +11,6 @@ export fn entry2() void {...@@ -11,8 +11,6 @@ export fn entry2() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :2:14: error: expected type 'f32', found 'f64'15// :2:14: error: expected type 'f32', found 'f64'
18// :9:19: error: expected type 'f32', found 'f64'16// :9:19: error: expected type 'f32', found 'f64'
test/cases/compile_errors/implicit_cast_of_error_set_not_a_subset.zig-2
...@@ -9,8 +9,6 @@ fn foo(set1: Set1) void {...@@ -9,8 +9,6 @@ fn foo(set1: Set1) void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :7:21: error: expected type 'error{A,C}', found 'error{A,B}'13// :7:21: error: expected type 'error{A,C}', found 'error{A,B}'
16// :7:21: note: 'error.B' not a member of destination error set14// :7:21: note: 'error.B' not a member of destination error set
test/cases/compile_errors/implicit_cast_to_c_ptr_from_int.zig-2
...@@ -7,8 +7,6 @@ export fn entry2() void {...@@ -7,8 +7,6 @@ export fn entry2() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :3:21: error: expected type '[*c]u8', found 'u65'11// :3:21: error: expected type '[*c]u8', found 'u65'
14// :3:21: note: unsigned 64-bit int cannot represent all possible unsigned 65-bit values12// :3:21: note: unsigned 64-bit int cannot represent all possible unsigned 65-bit values
test/cases/compile_errors/implicit_casting_C_pointers_which_would_mess_up_null_semantics.zig-2
...@@ -20,8 +20,6 @@ export fn entry2() void {...@@ -20,8 +20,6 @@ export fn entry2() void {
20}20}
2121
22// error22// error
23// backend=stage2
24// target=native
25//23//
26// :6:24: error: expected type '*const [*]const u8', found '[*c]const [*c]const u8'24// :6:24: error: expected type '*const [*]const u8', found '[*c]const [*c]const u8'
27// :6:24: note: '[*c]const [*c]const u8' could have null values which are illegal in type '*const [*]const u8'25// :6:24: note: '[*c]const [*c]const u8' could have null values which are illegal in type '*const [*]const u8'
test/cases/compile_errors/implicit_casting_null_c_pointer_to_zig_pointer.zig-2
...@@ -6,7 +6,5 @@ comptime {...@@ -6,7 +6,5 @@ comptime {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :3:26: error: null pointer casted to type '*u8'10// :3:26: error: null pointer casted to type '*u8'
test/cases/compile_errors/implicit_dependency_on_libc.zig-1
...@@ -4,7 +4,6 @@ export fn entry() void {...@@ -4,7 +4,6 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native-linux7// target=native-linux
9//8//
10// :1:8: error: dependency on libc must be explicitly specified in the build command9// :1:8: error: dependency on libc must be explicitly specified in the build command
test/cases/compile_errors/implicit_semicolon-block_expr.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:11: error: expected ';' after statement12// :4:11: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-block_statement.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:9: error: expected ';' after statement12// :4:9: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-comptime_expression.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:20: error: expected ';' after statement12// :4:20: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-comptime_statement.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:18: error: expected ';' after statement12// :4:18: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-defer.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:15: error: expected ';' after statement12// :4:15: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-for_expression.zig-2
...@@ -9,7 +9,5 @@ export fn entry() void {...@@ -9,7 +9,5 @@ export fn entry() void {
9fn foo() void {}9fn foo() void {}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :4:26: error: expected ';' after statement13// :4:26: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-for_statement.zig-2
...@@ -9,7 +9,5 @@ export fn entry() void {...@@ -9,7 +9,5 @@ export fn entry() void {
9fn foo() void {}9fn foo() void {}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :4:24: error: expected ';' or 'else' after statement13// :4:24: error: expected ';' or 'else' after statement
test/cases/compile_errors/implicit_semicolon-if-else-if-else_expression.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:45: error: expected ';' after statement12// :4:45: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-if-else-if-else_statement.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:47: error: expected ';' after statement12// :4:47: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-if-else-if_expression.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:37: error: expected ';' after statement12// :4:37: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-if-else-if_statement.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:37: error: expected ';' or 'else' after statement12// :4:37: error: expected ';' or 'else' after statement
test/cases/compile_errors/implicit_semicolon-if-else_expression.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:28: error: expected ';' after statement12// :4:28: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-if-else_statement.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:28: error: expected ';' after statement12// :4:28: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-if_expression.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:20: error: expected ';' after statement12// :4:20: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-if_statement.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:18: error: expected ';' or 'else' after statement12// :4:18: error: expected ';' or 'else' after statement
test/cases/compile_errors/implicit_semicolon-test_expression.zig-2
...@@ -9,7 +9,5 @@ export fn entry() void {...@@ -9,7 +9,5 @@ export fn entry() void {
9fn foo() void {}9fn foo() void {}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :4:26: error: expected ';' after statement13// :4:26: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-test_statement.zig-2
...@@ -9,7 +9,5 @@ export fn entry() void {...@@ -9,7 +9,5 @@ export fn entry() void {
9fn foo() void {}9fn foo() void {}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :4:24: error: expected ';' or 'else' after statement13// :4:24: error: expected ';' or 'else' after statement
test/cases/compile_errors/implicit_semicolon-while-continue_expression.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:28: error: expected ';' after statement12// :4:28: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-while-continue_statement.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:26: error: expected ';' or 'else' after statement12// :4:26: error: expected ';' or 'else' after statement
test/cases/compile_errors/implicit_semicolon-while_expression.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:23: error: expected ';' after statement12// :4:23: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-while_statement.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:18: error: expected ';' or 'else' after statement12// :4:18: error: expected ';' or 'else' after statement
test/cases/compile_errors/implicitly_casting_enum_to_tag_type.zig-2
...@@ -11,8 +11,6 @@ export fn entry() void {...@@ -11,8 +11,6 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :9:22: error: expected type 'u2', found 'tmp.Small'15// :9:22: error: expected type 'u2', found 'tmp.Small'
18// :1:15: note: enum declared here16// :1:15: note: enum declared here
test/cases/compile_errors/implicitly_increasing_pointer_alignment.zig-2
...@@ -13,8 +13,6 @@ fn bar(x: *u32) void {...@@ -13,8 +13,6 @@ fn bar(x: *u32) void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :8:9: error: expected type '*u32', found '*align(1) u32'17// :8:9: error: expected type '*u32', found '*align(1) u32'
20// :8:9: note: pointer alignment '1' cannot cast into pointer alignment '4'18// :8:9: note: pointer alignment '1' cannot cast into pointer alignment '4'
test/cases/compile_errors/implicitly_increasing_slice_alignment.zig-2
...@@ -14,8 +14,6 @@ fn bar(x: []u32) void {...@@ -14,8 +14,6 @@ fn bar(x: []u32) void {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :9:22: error: expected type '*[1]u32', found '*align(1) u32'18// :9:22: error: expected type '*[1]u32', found '*align(1) u32'
21// :9:22: note: pointer alignment '1' cannot cast into pointer alignment '4'19// :9:22: note: pointer alignment '1' cannot cast into pointer alignment '4'
test/cases/compile_errors/in_memory_coerce_vector_to_array.zig-2
...@@ -8,8 +8,6 @@ fn bar() anyerror!@Vector(4, u32) {...@@ -8,8 +8,6 @@ fn bar() anyerror!@Vector(4, u32) {
8 return .{ 1, 2, 3, 4 };8 return .{ 1, 2, 3, 4 };
9}9}
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :5:15: error: expected type 'anyerror![4]u32', found 'anyerror!@Vector(4, u32)'12// :5:15: error: expected type 'anyerror![4]u32', found 'anyerror!@Vector(4, u32)'
15// :5:15: note: error union payload '@Vector(4, u32)' cannot cast into error union payload '[4]u32'13// :5:15: note: error union payload '@Vector(4, u32)' cannot cast into error union payload '[4]u32'
test/cases/compile_errors/incompatible sub-byte fields.zig -2
...@@ -22,8 +22,6 @@ export fn entry() void {...@@ -22,8 +22,6 @@ export fn entry() void {
22 }22 }
23}23}
24// error24// error
25// backend=stage2
26// target=native
27//25//
28// :15:17: error: incompatible types: '*align(1:0:1) u2' and '*align(2:8:2) u2'26// :15:17: error: incompatible types: '*align(1:0:1) u2' and '*align(2:8:2) u2'
29// :16:14: note: type '*align(1:0:1) u2' here27// :16:14: note: type '*align(1:0:1) u2' here
test/cases/compile_errors/incompatible_sentinels.zig-2
...@@ -16,8 +16,6 @@ export fn entry4() void {...@@ -16,8 +16,6 @@ export fn entry4() void {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :4:12: error: expected type '[*:0]u8', found '[*:255]u8'20// :4:12: error: expected type '[*:0]u8', found '[*:255]u8'
23// :4:12: note: pointer sentinel '255' cannot cast into pointer sentinel '0'21// :4:12: note: pointer sentinel '255' cannot cast into pointer sentinel '0'
test/cases/compile_errors/incorrect_return_type.zig-2
...@@ -15,8 +15,6 @@ fn bar() B {...@@ -15,8 +15,6 @@ fn bar() B {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :8:15: error: expected type 'tmp.A', found 'tmp.B'19// :8:15: error: expected type 'tmp.A', found 'tmp.B'
22// :10:11: note: struct declared here20// :10:11: note: struct declared here
test/cases/compile_errors/incorrect_type_to_memset_memcpy.zig-2
...@@ -63,8 +63,6 @@ pub export fn memset_array() void {...@@ -63,8 +63,6 @@ pub export fn memset_array() void {
63}63}
6464
65// error65// error
66// backend=stage2
67// target=native
68//66//
69// :5:5: error: unknown copy length67// :5:5: error: unknown copy length
70// :5:18: note: destination type '[*]u8' provides no length68// :5:18: note: destination type '[*]u8' provides no length
test/cases/compile_errors/increase_pointer_alignment_in_ptrCast.zig-2
...@@ -5,8 +5,6 @@ export fn entry() u32 {...@@ -5,8 +5,6 @@ export fn entry() u32 {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:23: error: @ptrCast increases pointer alignment9// :3:23: error: @ptrCast increases pointer alignment
12// :3:32: note: '*u8' has alignment '1'10// :3:32: note: '*u8' has alignment '1'
test/cases/compile_errors/indexing_an_array_of_size_zero.zig-2
...@@ -5,7 +5,5 @@ export fn foo() void {...@@ -5,7 +5,5 @@ export fn foo() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:27: error: indexing into empty array is not allowed9// :3:27: error: indexing into empty array is not allowed
test/cases/compile_errors/indexing_an_array_of_size_zero_with_runtime_index.zig-2
...@@ -7,7 +7,5 @@ export fn foo() void {...@@ -7,7 +7,5 @@ export fn foo() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :5:27: error: indexing into empty array is not allowed11// :5:27: error: indexing into empty array is not allowed
test/cases/compile_errors/indexing_non-tuple_struct.zig-2
...@@ -5,8 +5,6 @@ export fn a() void {...@@ -5,8 +5,6 @@ export fn a() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :4:6: error: type 'tmp.a.S' does not support indexing9// :4:6: error: type 'tmp.a.S' does not support indexing
12// :4:6: note: operand must be an array, slice, tuple, or vector10// :4:6: note: operand must be an array, slice, tuple, or vector
test/cases/compile_errors/indexing_single-item_pointer.zig-2
...@@ -3,8 +3,6 @@ export fn entry(ptr: *i32) i32 {...@@ -3,8 +3,6 @@ export fn entry(ptr: *i32) i32 {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:15: error: type '*i32' does not support indexing7// :2:15: error: type '*i32' does not support indexing
10// :2:15: note: operand must be an array, slice, tuple, or vector8// :2:15: note: operand must be an array, slice, tuple, or vector
test/cases/compile_errors/indirect_struct_loop.zig-2
...@@ -12,7 +12,5 @@ export fn entry() usize {...@@ -12,7 +12,5 @@ export fn entry() usize {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :1:11: error: struct 'tmp.A' depends on itself16// :1:11: error: struct 'tmp.A' depends on itself
test/cases/compile_errors/inferred_array_size_invalid_here.zig-2
...@@ -9,8 +9,6 @@ export fn entry2() void {...@@ -9,8 +9,6 @@ export fn entry2() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :2:16: error: unable to infer array size13// :2:16: error: unable to infer array size
16// :6:35: error: unable to infer array size14// :6:35: error: unable to infer array size
test/cases/compile_errors/initializing_array_with_struct_syntax.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:15: error: initializing array with struct syntax8// :2:15: error: initializing array with struct syntax
test/cases/compile_errors/inline_underscore_prong.zig-2
...@@ -9,7 +9,5 @@ pub export fn entry() void {...@@ -9,7 +9,5 @@ pub export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :7:16: error: cannot inline '_' prong13// :7:16: error: cannot inline '_' prong
test/cases/compile_errors/instantiating_an_undefined_value_for_an_invalid_struct_that_contains_itself.zig-2
...@@ -9,7 +9,5 @@ export fn entry() usize {...@@ -9,7 +9,5 @@ export fn entry() usize {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :1:13: error: struct 'tmp.Foo' depends on itself13// :1:13: error: struct 'tmp.Foo' depends on itself
test/cases/compile_errors/instantiating_an_undefined_value_for_an_invalid_union_that_contains_itself.zig-2
...@@ -9,7 +9,5 @@ export fn entry() usize {...@@ -9,7 +9,5 @@ export fn entry() usize {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :1:13: error: union 'tmp.Foo' depends on itself13// :1:13: error: union 'tmp.Foo' depends on itself
test/cases/compile_errors/intFromFloat_comptime_safety.zig-2
...@@ -9,8 +9,6 @@ comptime {...@@ -9,8 +9,6 @@ comptime {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :2:31: error: float value '-129.10000610351562' cannot be stored in integer type 'i8'13// :2:31: error: float value '-129.10000610351562' cannot be stored in integer type 'i8'
16// :5:31: error: float value '-1.100000023841858' cannot be stored in integer type 'u8'14// :5:31: error: float value '-1.100000023841858' cannot be stored in integer type 'u8'
test/cases/compile_errors/intFromPtr_0_to_non_optional_pointer.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:33: error: pointer type '*i32' does not allow address zero8// :2:33: error: pointer type '*i32' does not allow address zero
test/cases/compile_errors/int_from_enum_undefined.zig-2
...@@ -6,8 +6,6 @@ export fn a() void {...@@ -6,8 +6,6 @@ export fn a() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :5:22: error: cannot use @intFromEnum on empty enum 'tmp.a.E'10// :5:22: error: cannot use @intFromEnum on empty enum 'tmp.a.E'
13// :2:15: note: enum declared here11// :2:15: note: enum declared here
test/cases/compile_errors/int_from_ptr_to_optional.zig-2
...@@ -5,8 +5,6 @@ comptime {...@@ -5,8 +5,6 @@ comptime {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :4:9: error: unable to evaluate comptime expression9// :4:9: error: unable to evaluate comptime expression
12// :4:21: note: operation is runtime due to this operand10// :4:21: note: operation is runtime due to this operand
test/cases/compile_errors/int_to_err_global_invalid_number.zig-2
...@@ -9,7 +9,5 @@ comptime {...@@ -9,7 +9,5 @@ comptime {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :7:27: error: integer value '3' represents no error13// :7:27: error: integer value '3' represents no error
test/cases/compile_errors/int_to_err_non_global_invalid_number.zig-2
...@@ -13,7 +13,5 @@ comptime {...@@ -13,7 +13,5 @@ comptime {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :11:21: error: 'error.B' not a member of error set 'error{A,C}'17// :11:21: error: 'error.B' not a member of error set 'error{A,C}'
test/cases/compile_errors/integer_cast_truncates_bits.zig-2
...@@ -20,8 +20,6 @@ export fn entry4() void {...@@ -20,8 +20,6 @@ export fn entry4() void {
20}20}
2121
22// error22// error
23// backend=stage2
24// target=native
25//23//
26// :3:31: error: type 'u8' cannot represent integer value '300'24// :3:31: error: type 'u8' cannot represent integer value '300'
27// :8:22: error: type 'u8' cannot represent integer value '300'25// :8:22: error: type 'u8' cannot represent integer value '300'
test/cases/compile_errors/integer_overflow_error.zig-2
...@@ -4,7 +4,5 @@ export fn entry() usize {...@@ -4,7 +4,5 @@ export fn entry() usize {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:15: error: type 'u8' cannot represent integer value '300'8// :1:15: error: type 'u8' cannot represent integer value '300'
test/cases/compile_errors/integer_underflow_error.zig-2
...@@ -3,7 +3,5 @@ export fn entry() void {...@@ -3,7 +3,5 @@ export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:84: error: overflow of integer type 'usize' with value '-1'7// :2:84: error: overflow of integer type 'usize' with value '-1'
test/cases/compile_errors/invalid_address_space_coercion.zig-1
...@@ -7,7 +7,6 @@ pub fn main() void {...@@ -7,7 +7,6 @@ pub fn main() void {
77
8// error8// error
9// output_mode=Exe9// output_mode=Exe
10// backend=stage2,llvm
11// target=x86_64-linux,x86_64-macos10// target=x86_64-linux,x86_64-macos
12//11//
13// :2:12: error: expected type '*i32', found '*addrspace(.gs) i32'12// :2:12: error: expected type '*i32', found '*addrspace(.gs) i32'
test/cases/compile_errors/invalid_array_assignment_with_valid_elems.zig-2
...@@ -5,7 +5,5 @@ export fn a() void {...@@ -5,7 +5,5 @@ export fn a() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// 3:23: error: expected type '[3]i32', found '[3]u16'9// 3:23: error: expected type '[3]i32', found '[3]u16'
test/cases/compile_errors/invalid_array_elem_ty.zig-2
...@@ -6,7 +6,5 @@ pub export fn entry() void {...@@ -6,7 +6,5 @@ pub export fn entry() void {
6}6}
77
8// error8// error
9// target=native
10// backend=stage2
11//9//
12// :5:12: error: expected type 'type', found 'fn () type'10// :5:12: error: expected type 'type', found 'fn () type'
test/cases/compile_errors/invalid_array_elem_type.zig-2
...@@ -6,8 +6,6 @@ comptime {...@@ -6,8 +6,6 @@ comptime {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:12: error: array of opaque type 'anyopaque' not allowed10// :2:12: error: array of opaque type 'anyopaque' not allowed
13// :5:12: error: array of 'noreturn' not allowed11// :5:12: error: array of 'noreturn' not allowed
test/cases/compile_errors/invalid_assignments.zig-2
...@@ -11,8 +11,6 @@ export fn entry4() void {...@@ -11,8 +11,6 @@ export fn entry4() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :3:6: error: invalid left-hand side to assignment15// :3:6: error: invalid left-hand side to assignment
18// :7:7: error: invalid left-hand side to assignment16// :7:7: error: invalid left-hand side to assignment
test/cases/compile_errors/invalid_bit_pointer.zig-2
...@@ -6,8 +6,6 @@ comptime {...@@ -6,8 +6,6 @@ comptime {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:18: error: packed type 'u8' at bit offset 32 starts 0 bits after the end of a 4 byte host integer10// :2:18: error: packed type 'u8' at bit offset 32 starts 0 bits after the end of a 4 byte host integer
13// :5:18: error: packed type 'u8' at bit offset 25 ends 1 bits after the end of a 4 byte host integer11// :5:18: error: packed type 'u8' at bit offset 25 ends 1 bits after the end of a 4 byte host integer
test/cases/compile_errors/invalid_break_expression.zig-2
...@@ -3,7 +3,5 @@ export fn f() void {...@@ -3,7 +3,5 @@ export fn f() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:5: error: break expression outside loop7// :2:5: error: break expression outside loop
test/cases/compile_errors/invalid_builtin_fn.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:8: error: invalid builtin function: '@bogus'8// :1:8: error: invalid builtin function: '@bogus'
test/cases/compile_errors/invalid_capture_type.zig-2
...@@ -17,8 +17,6 @@ export fn f5() void {...@@ -17,8 +17,6 @@ export fn f5() void {
17}17}
1818
19// error19// error
20// backend=stage2
21// target=native
22//20//
23// :2:9: error: expected optional type, found 'bool'21// :2:9: error: expected optional type, found 'bool'
24// :7:9: error: expected optional type, found 'usize'22// :7:9: error: expected optional type, found 'usize'
test/cases/compile_errors/invalid_cast_from_integral_type_to_enum.zig-2
...@@ -11,8 +11,6 @@ fn foo(x: usize) void {...@@ -11,8 +11,6 @@ fn foo(x: usize) void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :9:10: error: expected type 'usize', found 'tmp.E'15// :9:10: error: expected type 'usize', found 'tmp.E'
18// :1:11: note: enum declared here16// :1:11: note: enum declared here
test/cases/compile_errors/invalid_coercion_in_aggregate_literal.zig-2
...@@ -14,8 +14,6 @@ export fn invalidStructField() u8 {...@@ -14,8 +14,6 @@ export fn invalidStructField() u8 {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :2:41: error: type 'u8' cannot represent integer value '256'18// :2:41: error: type 'u8' cannot represent integer value '256'
21// :7:49: error: type 'u8' cannot represent integer value '256'19// :7:49: error: type 'u8' cannot represent integer value '256'
test/cases/compile_errors/invalid_coercion_in_labeled_break.zig-2
...@@ -6,7 +6,5 @@ export fn invalidBreak() u8 {...@@ -6,7 +6,5 @@ export fn invalidBreak() u8 {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :3:22: error: type 'u8' cannot represent integer value '256'10// :3:22: error: type 'u8' cannot represent integer value '256'
test/cases/compile_errors/invalid_compare_string.zig-2
...@@ -27,8 +27,6 @@ comptime {...@@ -27,8 +27,6 @@ comptime {
27}27}
2828
29// error29// error
30// backend=stage2
31// target=native
32//30//
33// :3:11: error: cannot compare strings with !=31// :3:11: error: cannot compare strings with !=
34// :7:11: error: cannot compare strings with ==32// :7:11: error: cannot compare strings with ==
test/cases/compile_errors/invalid_comparison_for_function_pointers.zig-2
...@@ -6,7 +6,5 @@ export fn entry() usize {...@@ -6,7 +6,5 @@ export fn entry() usize {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:21: error: operator > not allowed for type 'fn () void'10// :2:21: error: operator > not allowed for type 'fn () void'
test/cases/compile_errors/invalid_comptime_fields.zig-2
...@@ -12,8 +12,6 @@ const X = extern struct {...@@ -12,8 +12,6 @@ const X = extern struct {
12};12};
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :2:5: error: union fields cannot be marked comptime16// :2:5: error: union fields cannot be marked comptime
19// :5:5: error: enum fields cannot be marked comptime17// :5:5: error: enum fields cannot be marked comptime
test/cases/compile_errors/invalid_continue_expression.zig-2
...@@ -3,7 +3,5 @@ export fn f() void {...@@ -3,7 +3,5 @@ export fn f() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:5: error: continue expression outside loop7// :2:5: error: continue expression outside loop
test/cases/compile_errors/invalid_decltest.zig-2
...@@ -6,8 +6,6 @@ export fn foo() void {...@@ -6,8 +6,6 @@ export fn foo() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :4:14: error: cannot test a local constant10// :4:14: error: cannot test a local constant
13// :2:11: note: local constant declared here11// :2:11: note: local constant declared here
test/cases/compile_errors/invalid_dependency_on_struct_size.zig-2
...@@ -12,7 +12,5 @@ comptime {...@@ -12,7 +12,5 @@ comptime {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :6:21: error: struct layout depends on it having runtime bits16// :6:21: error: struct layout depends on it having runtime bits
test/cases/compile_errors/invalid_deref_on_switch_target.zig-2
...@@ -11,8 +11,6 @@ const Tile = enum {...@@ -11,8 +11,6 @@ const Tile = enum {
11};11};
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :3:17: error: cannot dereference non-pointer type 'tmp.Tile'15// :3:17: error: cannot dereference non-pointer type 'tmp.Tile'
18// :8:14: note: enum declared here16// :8:14: note: enum declared here
test/cases/compile_errors/invalid_destructure_astgen.zig-2
...@@ -13,8 +13,6 @@ export fn bar() void {...@@ -13,8 +13,6 @@ export fn bar() void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :2:25: error: expected 2 elements for destructure, found 317// :2:25: error: expected 2 elements for destructure, found 3
20// :2:22: note: result destructured here18// :2:22: note: result destructured here
test/cases/compile_errors/invalid_destructure_error_union.zig-2
...@@ -6,8 +6,6 @@ pub export fn entry() void {...@@ -6,8 +6,6 @@ pub export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :3:28: error: type 'anyerror!u32' cannot be destructured10// :3:28: error: type 'anyerror!u32' cannot be destructured
13// :3:26: note: result destructured here11// :3:26: note: result destructured here
test/cases/compile_errors/invalid_destructure_sema.zig-2
...@@ -14,8 +14,6 @@ export fn bar() void {...@@ -14,8 +14,6 @@ export fn bar() void {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :2:24: error: type 'comptime_int' cannot be destructured18// :2:24: error: type 'comptime_int' cannot be destructured
21// :2:22: note: result destructured here19// :2:22: note: result destructured here
test/cases/compile_errors/invalid_duplicate_test_decl_name.zig-2
...@@ -2,8 +2,6 @@ test "thingy" {}...@@ -2,8 +2,6 @@ test "thingy" {}
2test "thingy" {}2test "thingy" {}
33
4// error4// error
5// backend=stage2
6// target=native
7// is_test=true5// is_test=true
8//6//
9// :1:6: error: duplicate test name 'thingy'7// :1:6: error: duplicate test name 'thingy'
test/cases/compile_errors/invalid_empty_unicode_escape.zig-2
...@@ -3,7 +3,5 @@ export fn entry() void {...@@ -3,7 +3,5 @@ export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:19: error: empty unicode escape sequence7// :2:19: error: empty unicode escape sequence
test/cases/compile_errors/invalid_error_capture_discard.zig-2
...@@ -19,8 +19,6 @@ export fn d() void {...@@ -19,8 +19,6 @@ export fn d() void {
19}19}
2020
21// error21// error
22// backend=stage2
23// target=native
24//22//
25// :2:15: error: discard of error capture; omit it instead23// :2:15: error: discard of error capture; omit it instead
26// :3:9: error: use of undeclared identifier '_'24// :3:9: error: use of undeclared identifier '_'
test/cases/compile_errors/invalid_error_union_payload_type.zig-2
...@@ -12,8 +12,6 @@ comptime {...@@ -12,8 +12,6 @@ comptime {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :2:18: error: error union with payload of opaque type 'anyopaque' not allowed16// :2:18: error: error union with payload of opaque type 'anyopaque' not allowed
19// :5:18: error: error union with payload of error set type 'anyerror' not allowed17// :5:18: error: error union with payload of error set type 'anyerror' not allowed
test/cases/compile_errors/invalid_exponent_in_float_literal-1.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:28: error: invalid digit 'a' in exponent8// :2:28: error: invalid digit 'a' in exponent
test/cases/compile_errors/invalid_exponent_in_float_literal-2.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:29: error: invalid digit 'F' in exponent8// :2:29: error: invalid digit 'F' in exponent
test/cases/compile_errors/invalid_field_access_in_comptime.zig-2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:13: error: use of undeclared identifier 'doesnt_exist'8// :2:13: error: use of undeclared identifier 'doesnt_exist'
test/cases/compile_errors/invalid_field_in_struct_value_expression.zig-2
...@@ -29,8 +29,6 @@ pub export fn entry1() void {...@@ -29,8 +29,6 @@ pub export fn entry1() void {
29}29}
3030
31// error31// error
32// backend=stage2
33// target=native
34//32//
35// :10:10: error: no field named 'foo' in struct 'tmp.A'33// :10:10: error: no field named 'foo' in struct 'tmp.A'
36// :1:11: note: struct declared here34// :1:11: note: struct declared here
test/cases/compile_errors/invalid_float_casts.zig-2
...@@ -20,8 +20,6 @@ export fn qux() void {...@@ -20,8 +20,6 @@ export fn qux() void {
20}20}
2121
22// error22// error
23// backend=stage2
24// target=native
25//23//
26// :4:40: error: unable to cast runtime value to 'comptime_float'24// :4:40: error: unable to cast runtime value to 'comptime_float'
27// :9:18: error: expected integer type, found 'f32'25// :9:18: error: expected integer type, found 'f32'
test/cases/compile_errors/invalid_float_literal.zig-2
...@@ -7,7 +7,5 @@ pub fn main() void {...@@ -7,7 +7,5 @@ pub fn main() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :5:29: error: expected expression, found '.'11// :5:29: error: expected expression, found '.'
test/cases/compile_errors/invalid_function_types.zig-2
...@@ -15,8 +15,6 @@ comptime {...@@ -15,8 +15,6 @@ comptime {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :2:12: error: function type cannot have a name19// :2:12: error: function type cannot have a name
22// :5:21: error: function type cannot have an alignment20// :5:21: error: function type cannot have an alignment
test/cases/compile_errors/invalid_identifiers.zig-2
...@@ -18,8 +18,6 @@ comptime {...@@ -18,8 +18,6 @@ comptime {
18}18}
1919
20// error20// error
21// backend=stage2
22// target=native
23//21//
24// :1:8: error: library name cannot be empty22// :1:8: error: library name cannot be empty
25// :2:8: error: library name cannot be empty23// :2:8: error: library name cannot be empty
test/cases/compile_errors/invalid_if_expr_result_location_coercion.zig-2
...@@ -23,8 +23,6 @@ export fn invalidComptimeElse() u0 {...@@ -23,8 +23,6 @@ export fn invalidComptimeElse() u0 {
23}23}
2424
25// error25// error
26// backend=stage2
27// target=native
28//26//
29// :3:34: error: type 'u8' cannot represent integer value '256'27// :3:34: error: type 'u8' cannot represent integer value '256'
30// :9:34: error: type 'u8' cannot represent integer value '256'28// :9:34: error: type 'u8' cannot represent integer value '256'
test/cases/compile_errors/invalid_inline_else_type.zig-2
...@@ -22,8 +22,6 @@ pub export fn entry3() void {...@@ -22,8 +22,6 @@ pub export fn entry3() void {
22}22}
2323
24// error24// error
25// backend=stage2
26// target=native
27//25//
28// :5:21: error: cannot enumerate values of type 'anyerror' for 'inline else'26// :5:21: error: cannot enumerate values of type 'anyerror' for 'inline else'
29// :13:21: error: cannot enumerate values of type 'tmp.E' for 'inline else'27// :13:21: error: cannot enumerate values of type 'tmp.E' for 'inline else'
test/cases/compile_errors/invalid_int_casts.zig-2
...@@ -20,8 +20,6 @@ export fn qux() void {...@@ -20,8 +20,6 @@ export fn qux() void {
20}20}
2121
22// error22// error
23// backend=stage2
24// target=native
25//23//
26// :4:36: error: unable to cast runtime value to 'comptime_int'24// :4:36: error: unable to cast runtime value to 'comptime_int'
27// :9:18: error: expected float type, found 'u32'25// :9:18: error: expected float type, found 'u32'
test/cases/compile_errors/invalid_legacy_unicode_escape.zig-2
...@@ -3,7 +3,5 @@ export fn entry() void {...@@ -3,7 +3,5 @@ export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:17: error: invalid escape character: 'U'7// :2:17: error: invalid escape character: 'U'
test/cases/compile_errors/invalid_member_of_builtin_enum.zig-2
...@@ -5,8 +5,6 @@ export fn entry() void {...@@ -5,8 +5,6 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:38: error: enum 'builtin.OptimizeMode' has no member named 'x86'9// :3:38: error: enum 'builtin.OptimizeMode' has no member named 'x86'
12// : note: enum declared here10// : note: enum declared here
test/cases/compile_errors/invalid_multiple_dereferences.zig-2
...@@ -13,8 +13,6 @@ pub const Box = struct {...@@ -13,8 +13,6 @@ pub const Box = struct {
13};13};
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :4:8: error: cannot dereference non-pointer type 'tmp.Box'17// :4:8: error: cannot dereference non-pointer type 'tmp.Box'
20// :11:17: note: struct declared here18// :11:17: note: struct declared here
test/cases/compile_errors/invalid_non-exhaustive_enum_to_union.zig-2
...@@ -19,8 +19,6 @@ export fn bar() void {...@@ -19,8 +19,6 @@ export fn bar() void {
19}19}
2020
21// error21// error
22// backend=stage2
23// target=native
24//22//
25// :12:16: error: runtime coercion to union 'tmp.U' from non-exhaustive enum23// :12:16: error: runtime coercion to union 'tmp.U' from non-exhaustive enum
26// :1:11: note: enum declared here24// :1:11: note: enum declared here
test/cases/compile_errors/invalid_number_literals.zig-2
...@@ -18,8 +18,6 @@ comptime {...@@ -18,8 +18,6 @@ comptime {
18}18}
1919
20// error20// error
21// backend=stage2
22// target=native
23//21//
24// :2:11: error: unexpected period after exponent22// :2:11: error: unexpected period after exponent
25// :5:11: error: unexpected period after exponent23// :5:11: error: unexpected period after exponent
test/cases/compile_errors/invalid_optional_payload_type.zig-2
...@@ -6,8 +6,6 @@ comptime {...@@ -6,8 +6,6 @@ comptime {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:10: error: opaque type 'anyopaque' cannot be optional10// :2:10: error: opaque type 'anyopaque' cannot be optional
13// :5:10: error: type '@TypeOf(null)' cannot be optional11// :5:10: error: type '@TypeOf(null)' cannot be optional
test/cases/compile_errors/invalid_optional_type_in_extern_struct.zig-2
...@@ -6,8 +6,6 @@ export fn testf(fluff: *stroo) void {...@@ -6,8 +6,6 @@ export fn testf(fluff: *stroo) void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:10: error: extern structs cannot contain fields of type '?[*c]u8'10// :2:10: error: extern structs cannot contain fields of type '?[*c]u8'
13// :2:10: note: only pointer like optionals are extern compatible11// :2:10: note: only pointer like optionals are extern compatible
test/cases/compile_errors/invalid_peer_type_resolution.zig-2
...@@ -24,8 +24,6 @@ export fn incompatiblePointers4() void {...@@ -24,8 +24,6 @@ export fn incompatiblePointers4() void {
24}24}
2525
26// error26// error
27// backend=stage2
28// target=native
29//27//
30// :5:9: error: incompatible types: '?@Vector(10, i32)' and '@Vector(11, i32)'28// :5:9: error: incompatible types: '?@Vector(10, i32)' and '@Vector(11, i32)'
31// :5:17: note: type '?@Vector(10, i32)' here29// :5:17: note: type '?@Vector(10, i32)' here
test/cases/compile_errors/invalid_pointer_arithmetic.zig-2
...@@ -38,8 +38,6 @@ comptime {...@@ -38,8 +38,6 @@ comptime {
38}38}
3939
40// error40// error
41// backend=stage2
42// target=native
43//41//
44// :2:11: error: invalid pointer-integer arithmetic operator42// :2:11: error: invalid pointer-integer arithmetic operator
45// :2:11: note: pointer-integer arithmetic only supports addition and subtraction43// :2:11: note: pointer-integer arithmetic only supports addition and subtraction
test/cases/compile_errors/invalid_pointer_keeps_address_space_when_taking_address_of_dereference.zig-1
...@@ -7,7 +7,6 @@ pub fn main() void {...@@ -7,7 +7,6 @@ pub fn main() void {
77
8// error8// error
9// output_mode=Exe9// output_mode=Exe
10// backend=stage2,llvm
11// target=x86_64-linux,x86_64-macos10// target=x86_64-linux,x86_64-macos
12//11//
13// :2:12: error: expected type '*i32', found '*addrspace(.gs) i32'12// :2:12: error: expected type '*i32', found '*addrspace(.gs) i32'
test/cases/compile_errors/invalid_pointer_syntax.zig-2
...@@ -3,7 +3,5 @@ export fn foo() void {...@@ -3,7 +3,5 @@ export fn foo() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:16: error: expected type expression, found ':'7// :2:16: error: expected type expression, found ':'
test/cases/compile_errors/invalid_shift_amount_error.zig-2
...@@ -7,7 +7,5 @@ export fn entry() u16 {...@@ -7,7 +7,5 @@ export fn entry() u16 {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :3:17: error: type 'u3' cannot represent integer value '8'11// :3:17: error: type 'u3' cannot represent integer value '8'
test/cases/compile_errors/invalid_store_to_comptime_field.zig-2
...@@ -70,8 +70,6 @@ pub export fn entry8() void {...@@ -70,8 +70,6 @@ pub export fn entry8() void {
70}70}
7171
72// error72// error
73// target=native
74// backend=stage2
75//73//
76// :6:9: error: value stored in comptime field does not match the default value of the field74// :6:9: error: value stored in comptime field does not match the default value of the field
77// :14:9: error: value stored in comptime field does not match the default value of the field75// :14:9: error: value stored in comptime field does not match the default value of the field
test/cases/compile_errors/invalid_struct_field.zig-2
...@@ -20,8 +20,6 @@ export fn e() void {...@@ -20,8 +20,6 @@ export fn e() void {
20}20}
2121
22// error22// error
23// backend=stage2
24// target=native
25//23//
26// :4:7: error: no field named 'foo' in struct 'tmp.A'24// :4:7: error: no field named 'foo' in struct 'tmp.A'
27// :1:11: note: struct declared here25// :1:11: note: struct declared here
test/cases/compile_errors/invalid_switch_expr_result_location_coercion.zig-2
...@@ -37,8 +37,6 @@ export fn invalidNonExhaustiveProng(enum_value: Enum) u8 {...@@ -37,8 +37,6 @@ export fn invalidNonExhaustiveProng(enum_value: Enum) u8 {
37}37}
3838
39// error39// error
40// backend=stage2
41// target=native
42//40//
43// :5:19: error: type 'u8' cannot represent integer value '256'41// :5:19: error: type 'u8' cannot represent integer value '256'
44// :15:20: error: type 'u8' cannot represent integer value '256'42// :15:20: error: type 'u8' cannot represent integer value '256'
test/cases/compile_errors/invalid_tag_capture.zig-2
...@@ -8,8 +8,6 @@ pub export fn entry() void {...@@ -8,8 +8,6 @@ pub export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :5:33: error: cannot capture tag of non-union type 'tmp.E'12// :5:33: error: cannot capture tag of non-union type 'tmp.E'
15// :1:11: note: enum declared here13// :1:11: note: enum declared here
test/cases/compile_errors/invalid_tail_call.zig-1
...@@ -7,6 +7,5 @@ pub export fn entry() void {...@@ -7,6 +7,5 @@ pub export fn entry() void {
77
8// error8// error
9// backend=llvm9// backend=llvm
10// target=native
11//10//
12// :5:5: error: unable to perform tail call: type of function being called 'fn (usize) void' does not match type of calling function 'fn () callconv(.c) void'11// :5:5: error: unable to perform tail call: type of function being called 'fn (usize) void' does not match type of calling function 'fn () callconv(.c) void'
test/cases/compile_errors/invalid_type.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:8: error: use of undeclared identifier 'bogus'8// :1:8: error: use of undeclared identifier 'bogus'
test/cases/compile_errors/invalid_type_in_builtin_extern.zig-2
...@@ -8,8 +8,6 @@ pub export fn entry2() void {...@@ -8,8 +8,6 @@ pub export fn entry2() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :1:19: error: extern symbol cannot have type '*comptime_int'12// :1:19: error: extern symbol cannot have type '*comptime_int'
15// :1:19: note: pointer to comptime-only type 'comptime_int'13// :1:19: note: pointer to comptime-only type 'comptime_int'
test/cases/compile_errors/invalid_type_used_in_array_type.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:12: error: use of undeclared identifier 'SomeNonexistentType'12// :2:12: error: use of undeclared identifier 'SomeNonexistentType'
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-1.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:23: error: expected digit before digit separator8// :2:23: error: expected digit before digit separator
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-10.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:25: error: repeated digit separator8// :2:25: error: repeated digit separator
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-11.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:28: error: repeated digit separator8// :2:28: error: repeated digit separator
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-12.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:23: error: invalid digit 'x' for decimal base8// :2:23: error: invalid digit 'x' for decimal base
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-13.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:23: error: expected digit before digit separator8// :2:23: error: expected digit before digit separator
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-14.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:27: error: expected digit before exponent8// :2:27: error: expected digit before exponent
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-2.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:23: error: expected digit before '.'8// :2:23: error: expected digit before '.'
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-3.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:24: error: trailing digit separator8// :2:24: error: trailing digit separator
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-4.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:25: error: expected digit before digit separator8// :2:25: error: expected digit before digit separator
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-5.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:26: error: expected digit before digit separator8// :2:26: error: expected digit before digit separator
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-6.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:26: error: expected digit before digit separator8// :2:26: error: expected digit before digit separator
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-7.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:27: error: trailing digit separator8// :2:27: error: trailing digit separator
test/cases/compile_errors/invalid_underscore_placement_in_float_literal-9.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:23: error: repeated digit separator8// :2:23: error: repeated digit separator
test/cases/compile_errors/invalid_underscore_placement_in_int_literal-1.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:23: error: trailing digit separator8// :2:23: error: trailing digit separator
test/cases/compile_errors/invalid_underscore_placement_in_int_literal-2.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:27: error: trailing digit separator8// :2:27: error: trailing digit separator
test/cases/compile_errors/invalid_underscore_placement_in_int_literal-3.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:27: error: trailing digit separator8// :2:27: error: trailing digit separator
test/cases/compile_errors/invalid_underscore_placement_in_int_literal-4.zig-2
...@@ -4,7 +4,5 @@ fn main() void {...@@ -4,7 +4,5 @@ fn main() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:27: error: trailing digit separator8// :2:27: error: trailing digit separator
test/cases/compile_errors/invalid_unicode_escape.zig-2
...@@ -3,8 +3,6 @@ export fn entry() void {...@@ -3,8 +3,6 @@ export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:21: error: expected hex digit or '}', found 'z'7// :2:21: error: expected hex digit or '}', found 'z'
108
test/cases/compile_errors/issue_15572_break_on_inline_while.zig-1
...@@ -14,7 +14,6 @@ pub fn main() void {...@@ -14,7 +14,6 @@ pub fn main() void {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=x86_64-linux17// target=x86_64-linux
19//18//
20// :9:28: error: incompatible types: 'builtin.Type.EnumField' and 'void'19// :9:28: error: incompatible types: 'builtin.Type.EnumField' and 'void'
test/cases/compile_errors/issue_2032_compile_diagnostic_string_for_top_level_decl_type.zig-2
...@@ -4,8 +4,6 @@ export fn entry() void {...@@ -4,8 +4,6 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:29: error: expected type 'u32', found 'tmp'8// :2:29: error: expected type 'u32', found 'tmp'
11// :1:1: note: struct declared here9// :1:1: note: struct declared here
test/cases/compile_errors/issue_3818_bitcast_from_parray-slice_to_u16.zig-2
...@@ -10,8 +10,6 @@ export fn foo2() void {...@@ -10,8 +10,6 @@ export fn foo2() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :3:37: error: cannot @bitCast from '*[2]u8'14// :3:37: error: cannot @bitCast from '*[2]u8'
17// :3:37: note: use @intFromPtr to cast to 'u16'15// :3:37: note: use @intFromPtr to cast to 'u16'
test/cases/compile_errors/issue_4207_coerce_from_non-terminated-slice_to_terminated-pointer.zig-2
...@@ -4,8 +4,6 @@ export fn foo() [*:0]const u8 {...@@ -4,8 +4,6 @@ export fn foo() [*:0]const u8 {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:18: error: expected type '[*:0]const u8', found '*[64]u8'8// :3:18: error: expected type '[*:0]const u8', found '*[64]u8'
11// :3:18: note: destination pointer requires '0' sentinel9// :3:18: note: destination pointer requires '0' sentinel
test/cases/compile_errors/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig-2
...@@ -11,8 +11,6 @@ export fn foo() void {...@@ -11,8 +11,6 @@ export fn foo() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :7:28: error: expected type '[]u8', found '*const [3:0]u8'15// :7:28: error: expected type '[]u8', found '*const [3:0]u8'
18// :7:28: note: cast discards const qualifier16// :7:28: note: cast discards const qualifier
test/cases/compile_errors/issue_5618_coercion_of_optional_anyopaque_to_anyopaque_must_fail.zig-2
...@@ -5,8 +5,6 @@ export fn foo() void {...@@ -5,8 +5,6 @@ export fn foo() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :4:13: error: expected type '*anyopaque', found '?*anyopaque'9// :4:13: error: expected type '*anyopaque', found '?*anyopaque'
12// :4:13: note: cannot convert optional to payload type10// :4:13: note: cannot convert optional to payload type
test/cases/compile_errors/issue_9346_return_outside_of_function_scope.zig-2
...@@ -1,7 +1,5 @@...@@ -1,7 +1,5 @@
1pub const empty = return 1;1pub const empty = return 1;
22
3// error3// error
4// backend=stage2
5// target=native
6//4//
7// :1:19: error: 'return' outside function scope5// :1:19: error: 'return' outside function scope
test/cases/compile_errors/labeled_break_not_found.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :4:20: error: label not found: 'outer'11// :4:20: error: label not found: 'outer'
test/cases/compile_errors/labeled_continue_not_found.zig-2
...@@ -8,7 +8,5 @@ export fn entry() void {...@@ -8,7 +8,5 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :5:23: error: label not found: 'outer'12// :5:23: error: label not found: 'outer'
test/cases/compile_errors/leading_zero_in_integer.zig-2
...@@ -16,8 +16,6 @@ export fn entry4() void {...@@ -16,8 +16,6 @@ export fn entry4() void {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :2:15: error: primitive integer type 'u000123' has leading zero20// :2:15: error: primitive integer type 'u000123' has leading zero
23// :8:12: error: primitive integer type 'i01' has leading zero21// :8:12: error: primitive integer type 'i01' has leading zero
test/cases/compile_errors/len_access_on_array_many_ptr.zig-2
...@@ -4,7 +4,5 @@ export fn foo() void {...@@ -4,7 +4,5 @@ export fn foo() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:10: error: type '[*][5]u8' does not support field access8// :3:10: error: type '[*][5]u8' does not support field access
test/cases/compile_errors/load_too_many_bytes_from_comptime_reinterpreted_pointer.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :5:28: error: dereference of '*const i64' exceeds bounds of containing decl of type 'f32'11// :5:28: error: dereference of '*const i64' exceeds bounds of containing decl of type 'f32'
test/cases/compile_errors/load_vector_pointer_with_unknown_runtime_index.zig-2
...@@ -11,7 +11,5 @@ fn loadv(ptr: anytype) i31 {...@@ -11,7 +11,5 @@ fn loadv(ptr: anytype) i31 {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :10:15: error: unable to determine vector element index of type '*align(16:0:4:?) i31'15// :10:15: error: unable to determine vector element index of type '*align(16:0:4:?) i31'
test/cases/compile_errors/local_shadows_global_that_occurs_later.zig-2
...@@ -5,8 +5,6 @@ pub fn main() void {...@@ -5,8 +5,6 @@ pub fn main() void {
5fn foo() void {}5fn foo() void {}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:9: error: local variable shadows declaration of 'foo'9// :2:9: error: local variable shadows declaration of 'foo'
12// :5:1: note: declared here10// :5:1: note: declared here
test/cases/compile_errors/local_variable_redeclaration.zig-2
...@@ -4,8 +4,6 @@ export fn f() void {...@@ -4,8 +4,6 @@ export fn f() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:9: error: redeclaration of local constant 'a'8// :3:9: error: redeclaration of local constant 'a'
11// :2:11: note: previous declaration here9// :2:11: note: previous declaration here
test/cases/compile_errors/local_variable_redeclares_parameter.zig-2
...@@ -6,8 +6,6 @@ export fn entry() void {...@@ -6,8 +6,6 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:11: error: local constant 'a' shadows function parameter from outer scope10// :2:11: error: local constant 'a' shadows function parameter from outer scope
13// :1:6: note: previous declaration here11// :1:6: note: previous declaration here
test/cases/compile_errors/local_variable_shadowing_global.zig-2
...@@ -7,8 +7,6 @@ export fn entry() void {...@@ -7,8 +7,6 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :5:9: error: local variable shadows declaration of 'Bar'11// :5:9: error: local variable shadows declaration of 'Bar'
14// :2:1: note: declared here12// :2:1: note: declared here
test/cases/compile_errors/locally_shadowing_a_primitive_type.zig-2
...@@ -5,8 +5,6 @@ export fn foo() void {...@@ -5,8 +5,6 @@ export fn foo() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:11: error: name shadows primitive 'u8'9// :2:11: error: name shadows primitive 'u8'
12// :2:11: note: consider using @"u8" to disambiguate10// :2:11: note: consider using @"u8" to disambiguate
test/cases/compile_errors/main_function_with_bogus_args_type.zig-2
...@@ -3,7 +3,5 @@ pub fn main(args: [][]bogus) !void {...@@ -3,7 +3,5 @@ pub fn main(args: [][]bogus) !void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :1:23: error: use of undeclared identifier 'bogus'7// :1:23: error: use of undeclared identifier 'bogus'
test/cases/compile_errors/main_missing_name.zig-2
...@@ -1,8 +1,6 @@...@@ -1,8 +1,6 @@
1pub fn (main) void {}1pub fn (main) void {}
22
3// error3// error
4// backend=stage2
5// target=native
6// output_mode=Exe4// output_mode=Exe
7//5//
8// :1:5: error: missing function name6// :1:5: error: missing function name
test/cases/compile_errors/member_function_arg_mismatch.zig-2
...@@ -8,8 +8,6 @@ pub export fn entry() void {...@@ -8,8 +8,6 @@ pub export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :7:6: error: member function expected 2 argument(s), found 112// :7:6: error: member function expected 2 argument(s), found 1
15// :3:5: note: function declared here13// :3:5: note: function declared here
test/cases/compile_errors/memset_no_length.zig-2
...@@ -10,8 +10,6 @@ export fn bar() void {...@@ -10,8 +10,6 @@ export fn bar() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :4:5: error: unknown @memset length14// :4:5: error: unknown @memset length
17// :4:13: note: destination type '[*]u8' provides no length15// :4:13: note: destination type '[*]u8' provides no length
test/cases/compile_errors/method_call_on_error_union.zig-2
...@@ -14,8 +14,6 @@ export fn entry() void {...@@ -14,8 +14,6 @@ export fn entry() void {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :13:6: error: no field or member function named 'a' in '@typeInfo(@typeInfo(@TypeOf(tmp.X.init)).@"fn".return_type.?).error_union.error_set!tmp.X'18// :13:6: error: no field or member function named 'a' in '@typeInfo(@typeInfo(@TypeOf(tmp.X.init)).@"fn".return_type.?).error_union.error_set!tmp.X'
21// :13:6: note: consider using 'try', 'catch', or 'if'19// :13:6: note: consider using 'try', 'catch', or 'if'
test/cases/compile_errors/method_call_with_first_arg_type_primitive.zig-2
...@@ -15,8 +15,6 @@ export fn f() void {...@@ -15,8 +15,6 @@ export fn f() void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :14:9: error: no field or member function named 'init' in 'tmp.Foo'19// :14:9: error: no field or member function named 'init' in 'tmp.Foo'
22// :1:13: note: struct declared here20// :1:13: note: struct declared here
test/cases/compile_errors/method_call_with_first_arg_type_wrong_container.zig-2
...@@ -24,8 +24,6 @@ export fn foo() void {...@@ -24,8 +24,6 @@ export fn foo() void {
24}24}
2525
26// error26// error
27// backend=stage2
28// target=native
29//27//
30// :23:6: error: no field or member function named 'init' in 'tmp.List'28// :23:6: error: no field or member function named 'init' in 'tmp.List'
31// :1:18: note: struct declared here29// :1:18: note: struct declared here
test/cases/compile_errors/minmax_missing_args.zig-2
...@@ -2,8 +2,6 @@ comptime { _ = @min(1); }...@@ -2,8 +2,6 @@ comptime { _ = @min(1); }
2comptime { _ = @max(1); }2comptime { _ = @max(1); }
33
4// error4// error
5// backend=stage2
6// target=native
7//5//
8// :1:16: error: expected at least 2 arguments, found 16// :1:16: error: expected at least 2 arguments, found 1
9// :2:16: error: expected at least 2 arguments, found 17// :2:16: error: expected at least 2 arguments, found 1
test/cases/compile_errors/minmax_nonnumeric_operand.zig-2
...@@ -19,8 +19,6 @@ const Enum = enum { foo };...@@ -19,8 +19,6 @@ const Enum = enum { foo };
19const Union = union { foo: void };19const Union = union { foo: void };
2020
21// error21// error
22// backend=stage2
23// target=native
24//22//
25// :2:24: error: expected number, found 'type'23// :2:24: error: expected number, found 'type'
26// :3:24: error: expected number, found 'void'24// :3:24: error: expected number, found 'void'
test/cases/compile_errors/missing_boolean_switch_value.zig-2
...@@ -12,8 +12,6 @@ comptime {...@@ -12,8 +12,6 @@ comptime {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :2:15: error: switch must handle all possibilities16// :2:15: error: switch must handle all possibilities
19// :8:15: error: switch must handle all possibilities17// :8:15: error: switch must handle all possibilities
test/cases/compile_errors/missing_builtin_arg_in_initializer.zig-2
...@@ -9,8 +9,6 @@ comptime {...@@ -9,8 +9,6 @@ comptime {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :2:15: error: expected 2 arguments, found 013// :2:15: error: expected 2 arguments, found 0
16// :5:15: error: expected 1 argument, found 014// :5:15: error: expected 1 argument, found 0
test/cases/compile_errors/missing_const_in_slice_with_nested_array_type.zig-2
...@@ -12,7 +12,5 @@ export fn entry() void {...@@ -12,7 +12,5 @@ export fn entry() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :4:26: error: array literal requires address-of operator (&) to coerce to slice type '[][2]f32'16// :4:26: error: array literal requires address-of operator (&) to coerce to slice type '[][2]f32'
test/cases/compile_errors/missing_digit_after_base.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:27: error: expected a digit after base prefix8// :2:27: error: expected a digit after base prefix
test/cases/compile_errors/missing_else_clause.zig-2
...@@ -31,8 +31,6 @@ export fn entry() void {...@@ -31,8 +31,6 @@ export fn entry() void {
31 k(true);31 k(true);
32}32}
33// error33// error
34// backend=stage2
35// target=native
36//34//
37// :2:20: error: expected type 'i32', found 'void'35// :2:20: error: expected type 'i32', found 'void'
38// :8:15: error: incompatible types: 'i32' and 'void'36// :8:15: error: incompatible types: 'i32' and 'void'
test/cases/compile_errors/missing_field_in_struct_value_expression.zig-2
...@@ -23,8 +23,6 @@ export fn h() void {...@@ -23,8 +23,6 @@ export fn h() void {
23 _ = c;23 _ = c;
24}24}
25// error25// error
26// backend=stage2
27// target=native
28//26//
29// :9:16: error: missing struct field: x27// :9:16: error: missing struct field: x
30// :1:11: note: struct declared here28// :1:11: note: struct declared here
test/cases/compile_errors/missing_function_name.zig-2
...@@ -1,7 +1,5 @@...@@ -1,7 +1,5 @@
1fn () void {}1fn () void {}
22
3// error3// error
4// backend=stage2
5// target=native
6//4//
7// :1:1: error: missing function name5// :1:1: error: missing function name
test/cases/compile_errors/missing_function_proto_name.zig-2
...@@ -1,7 +1,5 @@...@@ -1,7 +1,5 @@
1fn () void;1fn () void;
22
3// error3// error
4// backend=stage2
5// target=native
6//4//
7// :1:1: error: missing function name5// :1:1: error: missing function name
test/cases/compile_errors/missing_param_name.zig-2
...@@ -4,7 +4,5 @@ export fn entry() usize {...@@ -4,7 +4,5 @@ export fn entry() usize {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:6: error: missing parameter name8// :1:6: error: missing parameter name
test/cases/compile_errors/missing_parameter_name.zig-2
...@@ -9,8 +9,6 @@ fn f1(x) u64 {...@@ -9,8 +9,6 @@ fn f1(x) u64 {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :1:7: error: missing parameter name13// :1:7: error: missing parameter name
16// :4:7: error: missing parameter name14// :4:7: error: missing parameter name
test/cases/compile_errors/missing_parameter_name_of_generic_function.zig-2
...@@ -5,7 +5,5 @@ export fn entry() void {...@@ -5,7 +5,5 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :1:9: error: missing parameter name9// :1:9: error: missing parameter name
test/cases/compile_errors/missing_result_type_for_phi_node.zig-2
...@@ -6,8 +6,6 @@ export fn entry() void {...@@ -6,8 +6,6 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :5:11: error: incompatible types: 'void' and 'comptime_int'10// :5:11: error: incompatible types: 'void' and 'comptime_int'
13// :5:11: note: type 'void' here11// :5:11: note: type 'void' here
test/cases/compile_errors/misspelled_type_with_pointer_only_reference.zig-2
...@@ -29,7 +29,5 @@ fn foo() void {...@@ -29,7 +29,5 @@ fn foo() void {
29}29}
3030
31// error31// error
32// backend=stage2
33// target=native
34//32//
35// :5:16: error: use of undeclared identifier 'JsonList'33// :5:16: error: use of undeclared identifier 'JsonList'
test/cases/compile_errors/muladd_int_vector.zig-2
...@@ -3,7 +3,5 @@ comptime {...@@ -3,7 +3,5 @@ comptime {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:9: error: expected vector of floats or float type, found '@Vector(1, u32)'7// :2:9: error: expected vector of floats or float type, found '@Vector(1, u32)'
test/cases/compile_errors/negative_zero_literal.zig-2
...@@ -3,8 +3,6 @@ export fn foo() void {...@@ -3,8 +3,6 @@ export fn foo() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:10: error: integer literal '-0' is ambiguous7// :2:10: error: integer literal '-0' is ambiguous
10// :2:10: note: use '0' for an integer zero8// :2:10: note: use '0' for an integer zero
test/cases/compile_errors/nested_error_set_mismatch.zig-2
...@@ -11,8 +11,6 @@ fn foo() ?OtherError!i32 {...@@ -11,8 +11,6 @@ fn foo() ?OtherError!i32 {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :5:34: error: expected type '?error{NextError}!i32', found '?error{OutOfMemory}!i32'15// :5:34: error: expected type '?error{NextError}!i32', found '?error{OutOfMemory}!i32'
18// :5:34: note: optional type child 'error{OutOfMemory}!i32' cannot cast into optional type child 'error{NextError}!i32'16// :5:34: note: optional type child 'error{OutOfMemory}!i32' cannot cast into optional type child 'error{NextError}!i32'
test/cases/compile_errors/nested_generic_function_param_type_mismatch.zig-2
...@@ -16,8 +16,6 @@ pub export fn entry() void {...@@ -16,8 +16,6 @@ pub export fn entry() void {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :15:28: error: expected type '*const fn (type, u8, u8) u32', found '*const fn (void, u8, u8) u32'20// :15:28: error: expected type '*const fn (type, u8, u8) u32', found '*const fn (void, u8, u8) u32'
23// :15:28: note: pointer type child 'fn (void, u8, u8) u32' cannot cast into pointer type child 'fn (type, u8, u8) u32'21// :15:28: note: pointer type child 'fn (void, u8, u8) u32' cannot cast into pointer type child 'fn (type, u8, u8) u32'
test/cases/compile_errors/nested_ptr_cast_bad_operand.zig-2
...@@ -11,8 +11,6 @@ export fn c() void {...@@ -11,8 +11,6 @@ export fn c() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :3:45: error: null pointer casted to type '*const u32'15// :3:45: error: null pointer casted to type '*const u32'
18// :6:34: error: expected pointer type, found 'comptime_int'16// :6:34: error: expected pointer type, found 'comptime_int'
test/cases/compile_errors/nested_vectors.zig-2
...@@ -6,7 +6,5 @@ export fn entry() void {...@@ -6,7 +6,5 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :3:16: error: expected integer, float, bool, or pointer for the vector element type; found '@Vector(4, u8)'10// :3:16: error: expected integer, float, bool, or pointer for the vector element type; found '@Vector(4, u8)'
test/cases/compile_errors/no_else_prong_on_switch_on_global_error_set.zig-2
...@@ -8,7 +8,5 @@ fn foo(a: anyerror) void {...@@ -8,7 +8,5 @@ fn foo(a: anyerror) void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :5:5: error: else prong required when switching on type 'anyerror'12// :5:5: error: else prong required when switching on type 'anyerror'
test/cases/compile_errors/noalias_on_non_pointer_param.zig-2
...@@ -16,7 +16,5 @@ comptime {...@@ -16,7 +16,5 @@ comptime {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :1:6: error: non-pointer parameter declared noalias20// :1:6: error: non-pointer parameter declared noalias
test/cases/compile_errors/noalias_param_coersion.zig-2
...@@ -11,8 +11,6 @@ fn foo(noalias _: *i32, noalias _: *i32) void {}...@@ -11,8 +11,6 @@ fn foo(noalias _: *i32, noalias _: *i32) void {}
11fn bar(noalias _: *i32, _: *i32) void {}11fn bar(noalias _: *i32, _: *i32) void {}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :3:9: error: expected type 'fn (noalias *i32, noalias *i32) void', found 'fn (noalias *i32, *i32) void'15// :3:9: error: expected type 'fn (noalias *i32, noalias *i32) void', found 'fn (noalias *i32, *i32) void'
18// :3:9: note: regular parameter 1 cannot cast into a noalias parameter16// :3:9: note: regular parameter 1 cannot cast into a noalias parameter
test/cases/compile_errors/noinline_fn_cc_inline.zig-2
...@@ -5,7 +5,5 @@ comptime {...@@ -5,7 +5,5 @@ comptime {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :1:29: error: 'noinline' function cannot have calling convention 'inline'9// :1:29: error: 'noinline' function cannot have calling convention 'inline'
test/cases/compile_errors/non-const_switch_number_literal.zig-2
...@@ -11,8 +11,6 @@ fn bar() i32 {...@@ -11,8 +11,6 @@ fn bar() i32 {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :2:15: error: value with comptime-only type 'comptime_int' depends on runtime control flow15// :2:15: error: value with comptime-only type 'comptime_int' depends on runtime control flow
18// :2:26: note: runtime control flow here16// :2:26: note: runtime control flow here
test/cases/compile_errors/non-const_variables_of_things_that_require_const_variables.zig-2
...@@ -33,8 +33,6 @@ export fn entry8() void {...@@ -33,8 +33,6 @@ export fn entry8() void {
33}33}
3434
35// error35// error
36// backend=stage2
37// target=native
38//36//
39// :2:9: error: variable of type '*const comptime_int' must be const or comptime37// :2:9: error: variable of type '*const comptime_int' must be const or comptime
40// :6:9: error: variable of type '@TypeOf(undefined)' must be const or comptime38// :6:9: error: variable of type '@TypeOf(undefined)' must be const or comptime
test/cases/compile_errors/non-enum_tag_type_passed_to_union.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :1:19: error: expected enum tag type, found 'u32'11// :1:19: error: expected enum tag type, found 'u32'
test/cases/compile_errors/non-exhaustive_enum_field_non_final.zig-2
...@@ -5,7 +5,5 @@ const B = enum(u1) {...@@ -5,7 +5,5 @@ const B = enum(u1) {
5};5};
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:5: error: '_' field of non-exhaustive enum must be last9// :3:5: error: '_' field of non-exhaustive enum must be last
test/cases/compile_errors/non-exhaustive_enum_marker_assigned_a_value.zig-2
...@@ -14,8 +14,6 @@ comptime {...@@ -14,8 +14,6 @@ comptime {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :4:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value18// :4:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value
21// :6:11: error: non-exhaustive enum missing integer tag type19// :6:11: error: non-exhaustive enum missing integer tag type
test/cases/compile_errors/non-exhaustive_enum_specifies_every_value.zig-2
...@@ -8,7 +8,5 @@ pub export fn entry() void {...@@ -8,7 +8,5 @@ pub export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :1:11: error: non-exhaustive enum specifies every value12// :1:11: error: non-exhaustive enum specifies every value
test/cases/compile_errors/non-extern_function_with_var_args.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:14: error: expected type expression, found '...'8// :1:14: error: expected type expression, found '...'
test/cases/compile_errors/non-inline_for_loop_on_a_type_that_requires_comptime.zig-2
...@@ -10,8 +10,6 @@ export fn entry() void {...@@ -10,8 +10,6 @@ export fn entry() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :7:10: error: values of type '[2]tmp.Foo' must be comptime-known, but index value is runtime-known14// :7:10: error: values of type '[2]tmp.Foo' must be comptime-known, but index value is runtime-known
17// :3:8: note: struct requires comptime because of this field15// :3:8: note: struct requires comptime because of this field
test/cases/compile_errors/non-integer_tag_type_to_automatic_union_enum.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :1:24: error: expected integer tag type, found 'f32'11// :1:24: error: expected integer tag type, found 'f32'
test/cases/compile_errors/non-integer_tag_type_to_enum.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :1:18: error: expected integer tag type, found 'f32'11// :1:18: error: expected integer tag type, found 'f32'
test/cases/compile_errors/non_constant_expression_in_array_size.zig-2
...@@ -11,8 +11,6 @@ export fn entry() usize {...@@ -11,8 +11,6 @@ export fn entry() usize {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :6:12: error: unable to resolve comptime value15// :6:12: error: unable to resolve comptime value
18// :2:12: note: called at comptime from here16// :2:12: note: called at comptime from here
test/cases/compile_errors/non_error_sets_used_in_merge_error_sets_operator.zig-2
...@@ -8,8 +8,6 @@ export fn bar() void {...@@ -8,8 +8,6 @@ export fn bar() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:20: error: expected error set type, found 'u8'12// :2:20: error: expected error set type, found 'u8'
15// :6:31: error: expected error set type, found 'u16'13// :6:31: error: expected error set type, found 'u16'
test/cases/compile_errors/non_float_passed_to_intFromFloat.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:34: error: expected float type, found 'i32'8// :2:34: error: expected float type, found 'i32'
test/cases/compile_errors/non_int_passed_to_floatFromInt.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:34: error: expected integer type, found 'comptime_float'8// :2:34: error: expected integer type, found 'comptime_float'
test/cases/compile_errors/non_pointer_given_to_intFromPtr.zig-2
...@@ -3,7 +3,5 @@ export fn entry(x: i32) usize {...@@ -3,7 +3,5 @@ export fn entry(x: i32) usize {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:24: error: expected pointer, found 'i32'7// :2:24: error: expected pointer, found 'i32'
test/cases/compile_errors/non_void_error_union_payload_ignored.zig-2
...@@ -18,8 +18,6 @@ pub export fn entry2() void {...@@ -18,8 +18,6 @@ pub export fn entry2() void {
18}18}
1919
20// error20// error
21// backend=stage2
22// target=native
23//21//
24// :3:5: error: error union payload is ignored22// :3:5: error: error union payload is ignored
25// :3:5: note: payload value can be explicitly ignored with '|_|'23// :3:5: note: payload value can be explicitly ignored with '|_|'
test/cases/compile_errors/noreturn_builtins_divert_control_flow.zig-2
...@@ -12,8 +12,6 @@ export fn entry3() void {...@@ -12,8 +12,6 @@ export fn entry3() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :3:5: error: unreachable code16// :3:5: error: unreachable code
19// :2:5: note: control flow is diverted here17// :2:5: note: control flow is diverted here
test/cases/compile_errors/noreturn_struct_field.zig-2
...@@ -6,7 +6,5 @@ comptime {...@@ -6,7 +6,5 @@ comptime {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:8: error: struct fields cannot be 'noreturn'10// :2:8: error: struct fields cannot be 'noreturn'
test/cases/compile_errors/normal_string_with_newline.zig-2
...@@ -2,7 +2,5 @@ const foo = "a...@@ -2,7 +2,5 @@ const foo = "a
2b";2b";
33
4// error4// error
5// backend=stage2
6// target=native
7//5//
8// :1:15: error: string literal contains invalid byte: '\n'6// :1:15: error: string literal contains invalid byte: '\n'
test/cases/compile_errors/not_an_enum_type.zig-2
...@@ -13,8 +13,6 @@ const InvalidToken = struct {};...@@ -13,8 +13,6 @@ const InvalidToken = struct {};
13const ExpectedVarDeclOrFn = struct {};13const ExpectedVarDeclOrFn = struct {};
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :4:9: error: expected type '@typeInfo(tmp.Error).@"union".tag_type.?', found 'type'17// :4:9: error: expected type '@typeInfo(tmp.Error).@"union".tag_type.?', found 'type'
20// :8:15: note: enum declared here18// :8:15: note: enum declared here
test/cases/compile_errors/number_literal_bad_exponent.zig-2
...@@ -4,8 +4,6 @@ const c = 0x1E-4;...@@ -4,8 +4,6 @@ const c = 0x1E-4;
4const d = 0x1E+4;4const d = 0x1E+4;
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:15: error: sign '-' cannot follow digit 'e' in hex base8// :1:15: error: sign '-' cannot follow digit 'e' in hex base
11// :2:15: error: sign '+' cannot follow digit 'e' in hex base9// :2:15: error: sign '+' cannot follow digit 'e' in hex base
test/cases/compile_errors/offsetOf-bad_field_name.zig-2
...@@ -9,8 +9,6 @@ export fn foo() usize {...@@ -9,8 +9,6 @@ export fn foo() usize {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :7:9: error: no field named 'a' in struct 'tmp.Foo'13// :7:9: error: no field named 'a' in struct 'tmp.Foo'
16// :1:13: note: struct declared here14// :1:13: note: struct declared here
test/cases/compile_errors/offsetOf-non_struct.zig-2
...@@ -4,7 +4,5 @@ export fn foo() usize {...@@ -4,7 +4,5 @@ export fn foo() usize {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:22: error: expected struct type, found 'i32'8// :3:22: error: expected struct type, found 'i32'
test/cases/compile_errors/old_fn_ptr_in_extern_context.zig-2
...@@ -9,8 +9,6 @@ comptime {...@@ -9,8 +9,6 @@ comptime {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :2:8: error: extern structs cannot contain fields of type 'fn () callconv(.c) void'13// :2:8: error: extern structs cannot contain fields of type 'fn () callconv(.c) void'
16// :2:8: note: type has no guaranteed in-memory representation14// :2:8: note: type has no guaranteed in-memory representation
test/cases/compile_errors/only_equality_binary_operator_allowed_for_error_sets.zig-2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:23: error: operator > not allowed for type 'error{A,B}'8// :2:23: error: operator > not allowed for type 'error{A,B}'
test/cases/compile_errors/only_untyped_undef_coerces_to_all_types.zig-2
...@@ -5,7 +5,5 @@ pub export fn entry() void {...@@ -5,7 +5,5 @@ pub export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:20: error: expected type 'f32', found '[]u8'9// :3:20: error: expected type 'f32', found '[]u8'
test/cases/compile_errors/opaque_type_with_field.zig-2
...@@ -5,7 +5,5 @@ export fn entry() void {...@@ -5,7 +5,5 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :1:25: error: opaque types cannot have fields9// :1:25: error: opaque types cannot have fields
test/cases/compile_errors/optional_empty_error_set.zig-2
...@@ -6,8 +6,6 @@ fn foo() !void {...@@ -6,8 +6,6 @@ fn foo() !void {
6 return x.?;6 return x.?;
7}7}
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :6:13: error: unable to unwrap null10// :6:13: error: unable to unwrap null
13// :2:17: note: called at comptime here11// :2:17: note: called at comptime here
test/cases/compile_errors/out_of_bounds_index.zig-1
...@@ -21,7 +21,6 @@ comptime {...@@ -21,7 +21,6 @@ comptime {
21}21}
2222
23// error23// error
24// target=native
25//24//
26// :4:32: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)25// :4:32: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)
27// :9:28: error: end index 6 out of bounds for array of length 4 +1 (sentinel)26// :9:28: error: end index 6 out of bounds for array of length 4 +1 (sentinel)
test/cases/compile_errors/out_of_int_range_comptime_float_passed_to_intFromFloat.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:33: error: float value '200' cannot be stored in integer type 'i8'8// :2:33: error: float value '200' cannot be stored in integer type 'i8'
test/cases/compile_errors/overflow_in_enum_value_allocation.zig-2
...@@ -8,7 +8,5 @@ pub export fn entry() void {...@@ -8,7 +8,5 @@ pub export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:5: error: enumeration value '256' too large for type 'u8'12// :3:5: error: enumeration value '256' too large for type 'u8'
test/cases/compile_errors/packed_struct_backing_int_wrong.zig-2
...@@ -43,8 +43,6 @@ export fn entry7() void {...@@ -43,8 +43,6 @@ export fn entry7() void {
43}43}
4444
45// error45// error
46// backend=stage2
47// target=native
48//46//
49// :2:31: error: backing integer type 'u32' has bit size 32 but the struct fields have a total bit size of 2947// :2:31: error: backing integer type 'u32' has bit size 32 but the struct fields have a total bit size of 29
50// :9:31: error: backing integer type 'i31' has bit size 31 but the struct fields have a total bit size of 3248// :9:31: error: backing integer type 'i31' has bit size 31 but the struct fields have a total bit size of 32
test/cases/compile_errors/packed_struct_comparison.zig-2
...@@ -22,8 +22,6 @@ const Foo = packed struct {...@@ -22,8 +22,6 @@ const Foo = packed struct {
22};22};
2323
24// error24// error
25// backend=stage2
26// target=native
27//25//
28// :5:11: error: operator > not allowed for type 'tmp.Foo'26// :5:11: error: operator > not allowed for type 'tmp.Foo'
29// :19:20: note: struct declared here27// :19:20: note: struct declared here
test/cases/compile_errors/packed_struct_with_fields_of_not_allowed_types.zig-2
...@@ -78,8 +78,6 @@ export fn entry14() void {...@@ -78,8 +78,6 @@ export fn entry14() void {
78}78}
7979
80// error80// error
81// backend=stage2
82// target=native
83//81//
84// :3:12: error: packed structs cannot contain fields of type 'anyerror'82// :3:12: error: packed structs cannot contain fields of type 'anyerror'
85// :3:12: note: type has no guaranteed in-memory representation83// :3:12: note: type has no guaranteed in-memory representation
test/cases/compile_errors/packed_union_fields_mismatch.zig-2
...@@ -6,8 +6,6 @@ export fn entry1() void {...@@ -6,8 +6,6 @@ export fn entry1() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:16: error: packed union has fields with mismatching bit sizes10// :2:16: error: packed union has fields with mismatching bit sizes
13// :3:12: note: 1 bits here11// :3:12: note: 1 bits here
test/cases/compile_errors/packed_union_given_enum_tag_type.zig-2
...@@ -14,7 +14,5 @@ export fn entry() void {...@@ -14,7 +14,5 @@ export fn entry() void {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :6:30: error: packed union does not support enum tag type18// :6:30: error: packed union does not support enum tag type
test/cases/compile_errors/packed_union_with_automatic_layout_field.zig-2
...@@ -12,8 +12,6 @@ export fn entry() void {...@@ -12,8 +12,6 @@ export fn entry() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :6:8: error: packed unions cannot contain fields of type 'tmp.Foo'16// :6:8: error: packed unions cannot contain fields of type 'tmp.Foo'
19// :6:8: note: only packed structs layout are allowed in packed types17// :6:8: note: only packed structs layout are allowed in packed types
test/cases/compile_errors/panic_called_at_compile_time.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :3:9: error: encountered @panic at comptime11// :3:9: error: encountered @panic at comptime
test/cases/compile_errors/panic_has_source_location.zig-2
...@@ -11,7 +11,5 @@ pub fn panic(_: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {...@@ -11,7 +11,5 @@ pub fn panic(_: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :10:5: error: panic15// :10:5: error: panic
test/cases/compile_errors/parameter_redeclaration.zig-2
...@@ -4,8 +4,6 @@ export fn entry() void {...@@ -4,8 +4,6 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:14: error: redeclaration of function parameter 'a'8// :1:14: error: redeclaration of function parameter 'a'
11// :1:6: note: previous declaration here9// :1:6: note: previous declaration here
test/cases/compile_errors/parameter_shadowing_global.zig-2
...@@ -5,8 +5,6 @@ export fn entry() void {...@@ -5,8 +5,6 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:6: error: function parameter shadows declaration of 'Foo'9// :2:6: error: function parameter shadows declaration of 'Foo'
12// :1:1: note: declared here10// :1:1: note: declared here
test/cases/compile_errors/pass_const_ptr_to_mutable_ptr_fn.zig-2
...@@ -14,8 +14,6 @@ export fn entry() usize {...@@ -14,8 +14,6 @@ export fn entry() usize {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :4:19: error: expected type '*[]const u8', found '*const []const u8'18// :4:19: error: expected type '*[]const u8', found '*const []const u8'
21// :4:19: note: cast discards const qualifier19// :4:19: note: cast discards const qualifier
test/cases/compile_errors/passing_a_not-aligned-enough_pointer_to_cmpxchg.zig-2
...@@ -6,8 +6,6 @@ export fn entry() bool {...@@ -6,8 +6,6 @@ export fn entry() bool {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :4:31: error: expected type '*i32', found '*align(1) i32'10// :4:31: error: expected type '*i32', found '*align(1) i32'
13// :4:31: note: pointer alignment '1' cannot cast into pointer alignment '4'11// :4:31: note: pointer alignment '1' cannot cast into pointer alignment '4'
test/cases/compile_errors/passing_an_under-aligned_function_pointer.zig-1
...@@ -9,7 +9,6 @@ fn alignedSmall() align(4) i32 {...@@ -9,7 +9,6 @@ fn alignedSmall() align(4) i32 {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=x86_64-linux12// target=x86_64-linux
14//13//
15// :2:35: error: expected type '*align(8) const fn () i32', found '*align(4) const fn () i32'14// :2:35: error: expected type '*align(8) const fn () i32', found '*align(4) const fn () i32'
test/cases/compile_errors/peer_cast_then_implicit_cast_const_pointer_to_mutable_C_pointer.zig-2
...@@ -4,8 +4,6 @@ export fn func() void {...@@ -4,8 +4,6 @@ export fn func() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:32: error: expected type '[*c]u8', found '*const [0:0]u8'8// :3:32: error: expected type '[*c]u8', found '*const [0:0]u8'
11// :3:32: note: cast discards const qualifier9// :3:32: note: cast discards const qualifier
test/cases/compile_errors/pointer_arithmetic_on_pointer-to-array.zig-2
...@@ -6,8 +6,6 @@ export fn foo() void {...@@ -6,8 +6,6 @@ export fn foo() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :4:17: error: incompatible types: '*[10]u8' and 'comptime_int'10// :4:17: error: incompatible types: '*[10]u8' and 'comptime_int'
13// :4:15: note: type '*[10]u8' here11// :4:15: note: type '*[10]u8' here
test/cases/compile_errors/pointer_attributes_checked_when_coercing_pointer_to_anon_literal.zig-2
...@@ -13,8 +13,6 @@ comptime {...@@ -13,8 +13,6 @@ comptime {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :2:29: error: expected type '[][]const u8', found '*const [2][]const u8'17// :2:29: error: expected type '[][]const u8', found '*const [2][]const u8'
20// :2:29: note: cast discards const qualifier18// :2:29: note: cast discards const qualifier
test/cases/compile_errors/pointer_to_anyopaque_slice.zig-2
...@@ -6,7 +6,5 @@ export fn x() void {...@@ -6,7 +6,5 @@ export fn x() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :4:9: error: expected type '[]anyopaque', found '*u32'10// :4:9: error: expected type '[]anyopaque', found '*u32'
test/cases/compile_errors/pointer_to_noreturn.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:9: error: pointer to noreturn not allowed8// :1:9: error: pointer to noreturn not allowed
test/cases/compile_errors/pointer_with_different_address_spaces.zig-1
...@@ -7,7 +7,6 @@ export fn entry2() void {...@@ -7,7 +7,6 @@ export fn entry2() void {
77
8// error8// error
9// output_mode=Obj9// output_mode=Obj
10// backend=stage2,llvm
11// target=x86_64-linux,x86_64-macos10// target=x86_64-linux,x86_64-macos
12//11//
13// :2:12: error: expected type '*addrspace(.fs) i32', found '*addrspace(.gs) i32'12// :2:12: error: expected type '*addrspace(.fs) i32', found '*addrspace(.gs) i32'
test/cases/compile_errors/pointers_with_different_address_spaces.zig-1
...@@ -7,7 +7,6 @@ pub fn main() void {...@@ -7,7 +7,6 @@ pub fn main() void {
77
8// error8// error
9// output_mode=Exe9// output_mode=Exe
10// backend=stage2,llvm
11// target=x86_64-linux,x86_64-macos10// target=x86_64-linux,x86_64-macos
12//11//
13// :2:13: error: expected type '*i32', found '*addrspace(.gs) i32'12// :2:13: error: expected type '*i32', found '*addrspace(.gs) i32'
test/cases/compile_errors/pointless discard.zig -2
...@@ -13,8 +13,6 @@ export fn bar() void {...@@ -13,8 +13,6 @@ export fn bar() void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :4:9: error: pointless discard of local variable17// :4:9: error: pointless discard of local variable
20// :3:5: note: used here18// :3:5: note: used here
test/cases/compile_errors/popCount-non-integer.zig-2
...@@ -3,7 +3,5 @@ export fn entry(x: f32) u32 {...@@ -3,7 +3,5 @@ export fn entry(x: f32) u32 {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:22: error: expected integer or vector, found 'f32'7// :2:22: error: expected integer or vector, found 'f32'
test/cases/compile_errors/primitives_take_precedence_over_declarations.zig-2
...@@ -5,7 +5,5 @@ export fn entry() void {...@@ -5,7 +5,5 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:19: error: type 'u8' cannot represent integer value '300'9// :3:19: error: type 'u8' cannot represent integer value '300'
test/cases/compile_errors/ptrCast_discards_const_qualifier.zig-2
...@@ -5,8 +5,6 @@ export fn entry() void {...@@ -5,8 +5,6 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:21: error: @ptrCast discards const qualifier9// :3:21: error: @ptrCast discards const qualifier
12// :3:21: note: use @constCast to discard const qualifier10// :3:21: note: use @constCast to discard const qualifier
test/cases/compile_errors/ptrFromInt_non_ptr_type.zig-2
...@@ -7,8 +7,6 @@ pub export fn entry2() void {...@@ -7,8 +7,6 @@ pub export fn entry2() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :2:18: error: expected pointer type, found 'i32'11// :2:18: error: expected pointer type, found 'i32'
14// :6:19: error: integer cannot be converted to slice type '[]u8'12// :6:19: error: integer cannot be converted to slice type '[]u8'
test/cases/compile_errors/ptrFromInt_with_misaligned_address.zig-2
...@@ -4,7 +4,5 @@ pub export fn entry() void {...@@ -4,7 +4,5 @@ pub export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:41: error: pointer type '[*]align(4) u8' requires aligned address8// :2:41: error: pointer type '[*]align(4) u8' requires aligned address
test/cases/compile_errors/ptr_coerced_to_slice.zig-2
...@@ -12,8 +12,6 @@ export fn baz() void {...@@ -12,8 +12,6 @@ export fn baz() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :3:25: error: expected type '[]const u8', found '[*]const u8'16// :3:25: error: expected type '[]const u8', found '[*]const u8'
19// :7:25: error: expected type '[]const u8', found '[*c]const u8'17// :7:25: error: expected type '[]const u8', found '[*c]const u8'
test/cases/compile_errors/ptrcast_to_non-pointer.zig-2
...@@ -3,7 +3,5 @@ export fn entry(a: *i32) usize {...@@ -3,7 +3,5 @@ export fn entry(a: *i32) usize {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:12: error: expected pointer type, found 'usize'7// :2:12: error: expected pointer type, found 'usize'
test/cases/compile_errors/range_operator_in_switch_used_on_error_set.zig-2
...@@ -13,8 +13,6 @@ fn foo(x: i32) !void {...@@ -13,8 +13,6 @@ fn foo(x: i32) !void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :2:34: error: ranges not allowed when switching on type '@typeInfo(@typeInfo(@TypeOf(tmp.foo)).@"fn".return_type.?).error_union.error_set'17// :2:34: error: ranges not allowed when switching on type '@typeInfo(@typeInfo(@TypeOf(tmp.foo)).@"fn".return_type.?).error_union.error_set'
20// :3:18: note: range here18// :3:18: note: range here
test/cases/compile_errors/reading_past_end_of_pointer_casted_array.zig-2
...@@ -14,8 +14,6 @@ comptime {...@@ -14,8 +14,6 @@ comptime {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :5:26: error: dereference of '*const u24' exceeds bounds of containing decl of type '[4]u8'18// :5:26: error: dereference of '*const u24' exceeds bounds of containing decl of type '[4]u8'
21// :12:26: error: dereference of '*const u32' exceeds bounds of containing decl of type '[4]u8'19// :12:26: error: dereference of '*const u32' exceeds bounds of containing decl of type '[4]u8'
test/cases/compile_errors/reassign_to_array_parameter.zig-2
...@@ -6,7 +6,5 @@ export fn entry() void {...@@ -6,7 +6,5 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:5: error: cannot assign to constant10// :2:5: error: cannot assign to constant
test/cases/compile_errors/reassign_to_slice_parameter.zig-2
...@@ -6,7 +6,5 @@ export fn entry() void {...@@ -6,7 +6,5 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:5: error: cannot assign to constant10// :2:5: error: cannot assign to constant
test/cases/compile_errors/reassign_to_struct_parameter.zig-2
...@@ -9,7 +9,5 @@ export fn entry() void {...@@ -9,7 +9,5 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :5:5: error: cannot assign to constant13// :5:5: error: cannot assign to constant
test/cases/compile_errors/redefinition_of_enums.zig-2
...@@ -2,8 +2,6 @@ const A = enum { x };...@@ -2,8 +2,6 @@ const A = enum { x };
2const A = enum { x };2const A = enum { x };
33
4// error4// error
5// backend=stage2
6// target=native
7//5//
8// :1:7: error: duplicate struct member name 'A'6// :1:7: error: duplicate struct member name 'A'
9// :2:7: note: duplicate name here7// :2:7: note: duplicate name here
test/cases/compile_errors/redefinition_of_global_variables.zig-2
...@@ -2,8 +2,6 @@ var a: i32 = 1;...@@ -2,8 +2,6 @@ var a: i32 = 1;
2var a: i32 = 2;2var a: i32 = 2;
33
4// error4// error
5// backend=stage2
6// target=native
7//5//
8// :1:5: error: duplicate struct member name 'a'6// :1:5: error: duplicate struct member name 'a'
9// :2:5: note: duplicate name here7// :2:5: note: duplicate name here
test/cases/compile_errors/redefinition_of_struct.zig-2
...@@ -2,8 +2,6 @@ const A = struct { x: i32 };...@@ -2,8 +2,6 @@ const A = struct { x: i32 };
2const A = struct { y: i32 };2const A = struct { y: i32 };
33
4// error4// error
5// backend=stage2
6// target=native
7//5//
8// :1:7: error: duplicate struct member name 'A'6// :1:7: error: duplicate struct member name 'A'
9// :2:7: note: duplicate name here7// :2:7: note: duplicate name here
test/cases/compile_errors/redundant_ptr_cast.zig-2
...@@ -11,8 +11,6 @@ export fn c() void {...@@ -11,8 +11,6 @@ export fn c() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :3:18: error: redundant @ptrCast15// :3:18: error: redundant @ptrCast
18// :6:44: error: redundant @alignCast16// :6:44: error: redundant @alignCast
test/cases/compile_errors/reference_to_const_data.zig-2
...@@ -27,8 +27,6 @@ export fn quux() void {...@@ -27,8 +27,6 @@ export fn quux() void {
27}27}
2828
29// error29// error
30// backend=stage2
31// target=native
32//30//
33// :3:8: error: cannot assign to constant31// :3:8: error: cannot assign to constant
34// :7:8: error: cannot assign to constant32// :7:8: error: cannot assign to constant
test/cases/compile_errors/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig-2
...@@ -15,8 +15,6 @@ export fn entry() void {...@@ -15,8 +15,6 @@ export fn entry() void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :12:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.get_uval)).@"fn".return_type.?).error_union.error_set!u32'19// :12:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.get_uval)).@"fn".return_type.?).error_union.error_set!u32'
22// :12:15: note: cannot convert error union to payload type20// :12:15: note: cannot convert error union to payload type
test/cases/compile_errors/reified_enum_field_value_overflow.zig-2
...@@ -13,7 +13,5 @@ comptime {...@@ -13,7 +13,5 @@ comptime {
13}13}
1414
15// error15// error
16// target=native
17// backend=stage2
18//16//
19// :2:15: error: field 'f2' with enumeration value '2' is too large for backing int type 'u1'17// :2:15: error: field 'f2' with enumeration value '2' is too large for backing int type 'u1'
test/cases/compile_errors/reify_enum_with_duplicate_field.zig-2
...@@ -13,8 +13,6 @@ export fn entry() void {...@@ -13,8 +13,6 @@ export fn entry() void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :2:9: error: duplicate enum field 'A'17// :2:9: error: duplicate enum field 'A'
20// :2:9: note: other field here18// :2:9: note: other field here
test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig-2
...@@ -13,8 +13,6 @@ export fn entry() void {...@@ -13,8 +13,6 @@ export fn entry() void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :2:9: error: enum tag value 10 already taken17// :2:9: error: enum tag value 10 already taken
20// :2:9: note: other enum tag value here18// :2:9: note: other enum tag value here
test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig-2
...@@ -12,7 +12,5 @@ comptime {...@@ -12,7 +12,5 @@ comptime {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :1:13: error: Type.Fn.is_generic must be false for @Type16// :1:13: error: Type.Fn.is_generic must be false for @Type
test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig-2
...@@ -12,7 +12,5 @@ comptime {...@@ -12,7 +12,5 @@ comptime {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :1:13: error: Type.Fn.return_type must be non-null for @Type16// :1:13: error: Type.Fn.return_type must be non-null for @Type
test/cases/compile_errors/reify_typeOf_with_incompatible_arguments.zig-2
...@@ -6,8 +6,6 @@ export fn entry() void {...@@ -6,8 +6,6 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :4:9: error: incompatible types: 'f32' and 'u32'10// :4:9: error: incompatible types: 'f32' and 'u32'
13// :4:17: note: type 'f32' here11// :4:17: note: type 'f32' here
test/cases/compile_errors/reify_typeOf_with_no_arguments.zig-2
...@@ -3,7 +3,5 @@ export fn entry() void {...@@ -3,7 +3,5 @@ export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:9: error: expected at least 1 argument, found 07// :2:9: error: expected at least 1 argument, found 0
test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig-2
...@@ -11,7 +11,5 @@ export fn entry() void {...@@ -11,7 +11,5 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :1:13: error: Type.Enum.tag_type must be an integer type15// :1:13: error: Type.Enum.tag_type must be an integer type
test/cases/compile_errors/reify_type_for_tagged_extern_union.zig-2
...@@ -28,7 +28,5 @@ export fn entry() void {...@@ -28,7 +28,5 @@ export fn entry() void {
28}28}
2929
30// error30// error
31// backend=stage2
32// target=native
33//31//
34// :13:16: error: extern union does not support enum tag type32// :13:16: error: extern union does not support enum tag type
test/cases/compile_errors/reify_type_for_tagged_packed_union.zig-2
...@@ -28,7 +28,5 @@ export fn entry() void {...@@ -28,7 +28,5 @@ export fn entry() void {
28}28}
2929
30// error30// error
31// backend=stage2
32// target=native
33//31//
34// :13:16: error: packed union does not support enum tag type32// :13:16: error: packed union does not support enum tag type
test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig-2
...@@ -27,8 +27,6 @@ export fn entry() void {...@@ -27,8 +27,6 @@ export fn entry() void {
27}27}
2828
29// error29// error
30// backend=stage2
31// target=native
32//30//
33// :13:16: error: enum fields missing in union31// :13:16: error: enum fields missing in union
34// :1:13: note: field 'arst' missing, declared here32// :1:13: note: field 'arst' missing, declared here
test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig-2
...@@ -27,8 +27,6 @@ export fn entry() void {...@@ -27,8 +27,6 @@ export fn entry() void {
27}27}
2828
29// error29// error
30// backend=stage2
31// target=native
32//30//
33// :12:16: error: no field named 'arst' in enum 'tmp.Tag'31// :12:16: error: no field named 'arst' in enum 'tmp.Tag'
34// :1:13: note: enum declared here32// :1:13: note: enum declared here
test/cases/compile_errors/reify_type_for_tagged_union_with_no_enum_fields.zig-2
...@@ -23,8 +23,6 @@ export fn entry() void {...@@ -23,8 +23,6 @@ export fn entry() void {
23}23}
2424
25// error25// error
26// backend=stage2
27// target=native
28//26//
29// :9:16: error: no field named 'signed' in enum 'tmp.Tag'27// :9:16: error: no field named 'signed' in enum 'tmp.Tag'
30// :1:13: note: enum declared here28// :1:13: note: enum declared here
test/cases/compile_errors/reify_type_for_tagged_union_with_no_union_fields.zig-2
...@@ -23,8 +23,6 @@ export fn entry() void {...@@ -23,8 +23,6 @@ export fn entry() void {
23}23}
2424
25// error25// error
26// backend=stage2
27// target=native
28//26//
29// :12:16: error: enum fields missing in union27// :12:16: error: enum fields missing in union
30// :1:13: note: field 'signed' missing, declared here28// :1:13: note: field 'signed' missing, declared here
test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig-2
...@@ -13,8 +13,6 @@ export fn entry() usize {...@@ -13,8 +13,6 @@ export fn entry() usize {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :1:18: error: opaque types have unknown size and therefore cannot be directly embedded in unions17// :1:18: error: opaque types have unknown size and therefore cannot be directly embedded in unions
20// :6:39: note: opaque declared here18// :6:39: note: opaque declared here
test/cases/compile_errors/reify_type_with_Type.Int.zig-2
...@@ -7,8 +7,6 @@ export fn entry() void {...@@ -7,8 +7,6 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :3:31: error: expected type 'builtin.Type', found 'builtin.Type.Int'11// :3:31: error: expected type 'builtin.Type', found 'builtin.Type.Int'
14// :?:?: note: struct declared here12// :?:?: note: struct declared here
test/cases/compile_errors/reject_extern_function_definitions_with_body.zig-2
...@@ -3,7 +3,5 @@ extern "c" fn definitelyNotInLibC(a: i32, b: i32) i32 {...@@ -3,7 +3,5 @@ extern "c" fn definitelyNotInLibC(a: i32, b: i32) i32 {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :1:1: error: extern functions have no body7// :1:1: error: extern functions have no body
test/cases/compile_errors/reject_extern_variables_with_initializers.zig-2
...@@ -1,7 +1,5 @@...@@ -1,7 +1,5 @@
1extern var foo: int = 2;1extern var foo: int = 2;
22
3// error3// error
4// backend=stage2
5// target=native
6//4//
7// :1:23: error: extern variables have no initializers5// :1:23: error: extern variables have no initializers
test/cases/compile_errors/repeated_invalid_field_access_to_generic_function_returning_type_crashes_compiler_2655.zig-2
...@@ -7,8 +7,6 @@ test "1" {...@@ -7,8 +7,6 @@ test "1" {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12// is_test=true10// is_test=true
13//11//
14// :2:12: error: use of undeclared identifier 'Q'12// :2:12: error: use of undeclared identifier 'Q'
test/cases/compile_errors/resolve_inferred_error_set_of_generic_fn.zig-2
...@@ -11,8 +11,6 @@ export fn entry() void {...@@ -11,8 +11,6 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :10:15: error: unable to resolve inferred error set of generic function15// :10:15: error: unable to resolve inferred error set of generic function
18// :1:1: note: generic function declared here16// :1:1: note: generic function declared here
test/cases/compile_errors/result_location_incompatibility_mismatching_handle_is_ptr.zig-2
...@@ -12,8 +12,6 @@ pub const Container = struct {...@@ -12,8 +12,6 @@ pub const Container = struct {
12};12};
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :3:23: error: expected type 'i32', found '?i32'16// :3:23: error: expected type 'i32', found '?i32'
19// :3:23: note: cannot convert optional to payload type17// :3:23: note: cannot convert optional to payload type
test/cases/compile_errors/result_location_incompatibility_mismatching_handle_is_ptr_generic_call.zig-2
...@@ -12,8 +12,6 @@ pub const Container = struct {...@@ -12,8 +12,6 @@ pub const Container = struct {
12};12};
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :3:23: error: expected type 'i32', found '?i32'16// :3:23: error: expected type 'i32', found '?i32'
19// :3:23: note: cannot convert optional to payload type17// :3:23: note: cannot convert optional to payload type
test/cases/compile_errors/return_from_defer_expression.zig-2
...@@ -17,8 +17,6 @@ export fn entry() usize {...@@ -17,8 +17,6 @@ export fn entry() usize {
17}17}
1818
19// error19// error
20// backend=stage2
21// target=native
22//20//
23// :4:11: error: 'try' not allowed inside defer expression21// :4:11: error: 'try' not allowed inside defer expression
24// :4:5: note: defer expression here22// :4:5: note: defer expression here
test/cases/compile_errors/return_from_naked_function.zig-2
...@@ -7,8 +7,6 @@ comptime {...@@ -7,8 +7,6 @@ comptime {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :2:5: error: cannot return from naked function11// :2:5: error: cannot return from naked function
14// :2:5: note: can only return using assembly12// :2:5: note: can only return using assembly
test/cases/compile_errors/return_incompatible_generic_struct.zig-2
...@@ -12,8 +12,6 @@ export fn entry() void {...@@ -12,8 +12,6 @@ export fn entry() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :8:18: error: expected type 'tmp.A(u32)', found 'tmp.B(u32)'16// :8:18: error: expected type 'tmp.A(u32)', found 'tmp.B(u32)'
19// :5:12: note: struct declared here17// :5:12: note: struct declared here
test/cases/compile_errors/return_invalid_type_from_test.zig-2
...@@ -3,8 +3,6 @@ test "example" {...@@ -3,8 +3,6 @@ test "example" {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8// is_test=true6// is_test=true
9//7//
10// :2:12: error: expected type 'anyerror!void', found 'comptime_int'8// :2:12: error: expected type 'anyerror!void', found 'comptime_int'
test/cases/compile_errors/return_undefined_from_noreturn.zig-2
...@@ -3,8 +3,6 @@ export fn entry() noreturn {...@@ -3,8 +3,6 @@ export fn entry() noreturn {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:12: error: function declared 'noreturn' returns7// :2:12: error: function declared 'noreturn' returns
10// :1:19: note: 'noreturn' declared here8// :1:19: note: 'noreturn' declared here
test/cases/compile_errors/runtime_@ptrFromInt_to_comptime_only_type.zig-1
...@@ -9,7 +9,6 @@ pub export fn callbackFin(id: c_int, arg: ?*anyopaque) void {...@@ -9,7 +9,6 @@ pub export fn callbackFin(id: c_int, arg: ?*anyopaque) void {
9}9}
1010
11// error11// error
12// target=native
13//12//
14// :5:54: error: pointer to comptime-only type '?*tmp.GuSettings' must be comptime-known, but operand is runtime-known13// :5:54: error: pointer to comptime-only type '?*tmp.GuSettings' must be comptime-known, but operand is runtime-known
15// :2:10: note: struct requires comptime because of this field14// :2:10: note: struct requires comptime because of this field
test/cases/compile_errors/runtime_cast_to_union_which_has_non-void_fields.zig-2
...@@ -13,8 +13,6 @@ fn foo(l: Letter) void {...@@ -13,8 +13,6 @@ fn foo(l: Letter) void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :11:22: error: runtime coercion from enum 'tmp.Letter' to union 'tmp.Value' which has non-void fields17// :11:22: error: runtime coercion from enum 'tmp.Letter' to union 'tmp.Value' which has non-void fields
20// :3:5: note: field 'A' has type 'i32'18// :3:5: note: field 'A' has type 'i32'
test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig-2
...@@ -11,8 +11,6 @@ export fn entry() void {...@@ -11,8 +11,6 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :9:54: error: values of type '[]const builtin.Type.StructField' must be comptime-known, but index value is runtime-known15// :9:54: error: values of type '[]const builtin.Type.StructField' must be comptime-known, but index value is runtime-known
18// : note: struct requires comptime because of this field16// : note: struct requires comptime because of this field
test/cases/compile_errors/runtime_indexing_comptime_array.zig-2
...@@ -23,8 +23,6 @@ pub export fn entry3() void {...@@ -23,8 +23,6 @@ pub export fn entry3() void {
23 _ = &i;23 _ = &i;
24}24}
25// error25// error
26// target=native
27// backend=stage2
28//26//
29// :7:10: error: values of type '[2]fn () void' must be comptime-known, but index value is runtime-known27// :7:10: error: values of type '[2]fn () void' must be comptime-known, but index value is runtime-known
30// :7:10: note: use '*const fn () void' for a function pointer type28// :7:10: note: use '*const fn () void' for a function pointer type
test/cases/compile_errors/runtime_to_comptime_num.zig-2
...@@ -22,8 +22,6 @@ pub export fn entry4() void {...@@ -22,8 +22,6 @@ pub export fn entry4() void {
22}22}
2323
24// error24// error
25// backend=stage2
26// target=native
27//25//
28// :4:27: error: unable to resolve comptime value26// :4:27: error: unable to resolve comptime value
29// :4:27: note: value casted to 'comptime_int' must be comptime-known27// :4:27: note: value casted to 'comptime_int' must be comptime-known
test/cases/compile_errors/runtime_value_in_switch_prong.zig-2
...@@ -7,8 +7,6 @@ pub export fn entry() void {...@@ -7,8 +7,6 @@ pub export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :4:9: error: unable to resolve comptime value11// :4:9: error: unable to resolve comptime value
14// :4:9: note: switch prong values must be comptime-known12// :4:9: note: switch prong values must be comptime-known
test/cases/compile_errors/saturating_arithmetic_does_not_allow_floats.zig-2
...@@ -3,7 +3,5 @@ export fn a() void {...@@ -3,7 +3,5 @@ export fn a() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:23: error: invalid operands to binary expression: 'float' and 'float'7// :2:23: error: invalid operands to binary expression: 'float' and 'float'
test/cases/compile_errors/saturating_shl_does_not_allow_negative_rhs.zig-2
...@@ -25,8 +25,6 @@ export fn d(rhs: @Vector(3, i32)) void {...@@ -25,8 +25,6 @@ export fn d(rhs: @Vector(3, i32)) void {
25}25}
2626
27// error27// error
28// backend=stage2
29// target=native
30//28//
31// :2:25: error: shift by negative amount '-1'29// :2:25: error: shift by negative amount '-1'
32// :7:12: error: shift by negative amount '-2'30// :7:12: error: shift by negative amount '-2'
test/cases/compile_errors/self_referential_struct_requires_comptime.zig-2
...@@ -8,8 +8,6 @@ pub export fn entry() void {...@@ -8,8 +8,6 @@ pub export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :6:12: error: variable of type 'tmp.S' must be const or comptime12// :6:12: error: variable of type 'tmp.S' must be const or comptime
15// :2:8: note: struct requires comptime because of this field13// :2:8: note: struct requires comptime because of this field
test/cases/compile_errors/self_referential_union_requires_comptime.zig-2
...@@ -8,8 +8,6 @@ pub export fn entry() void {...@@ -8,8 +8,6 @@ pub export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :6:12: error: variable of type 'tmp.U' must be const or comptime12// :6:12: error: variable of type 'tmp.U' must be const or comptime
15// :2:8: note: union requires comptime because of this field13// :2:8: note: union requires comptime because of this field
test/cases/compile_errors/setting_a_section_on_a_local_variable.zig-2
...@@ -4,7 +4,5 @@ export fn entry() i32 {...@@ -4,7 +4,5 @@ export fn entry() i32 {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:30: error: cannot set section of local variable 'foo'8// :2:30: error: cannot set section of local variable 'foo'
test/cases/compile_errors/shift_amount_has_to_be_an_integer_type.zig-2
...@@ -4,8 +4,6 @@ export fn entry() void {...@@ -4,8 +4,6 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:20: error: expected type 'comptime_int', found pointer8// :2:20: error: expected type 'comptime_int', found pointer
11// :2:20: note: address-of operator always returns a pointer9// :2:20: note: address-of operator always returns a pointer
test/cases/compile_errors/shift_by_negative_comptime_integer.zig-2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:20: error: shift by negative amount '-1'8// :2:20: error: shift by negative amount '-1'
test/cases/compile_errors/shift_on_type_with_non-power-of-two_size.zig-2
...@@ -28,8 +28,6 @@ export fn entry() void {...@@ -28,8 +28,6 @@ export fn entry() void {
28}28}
2929
30// error30// error
31// backend=stage2
32// target=native
33//31//
34// :6:22: error: shift amount '24' is too large for operand type 'u24'32// :6:22: error: shift amount '24' is too large for operand type 'u24'
35// :11:22: error: shift amount '24' is too large for operand type 'u24'33// :11:22: error: shift amount '24' is too large for operand type 'u24'
test/cases/compile_errors/shifting_RHS_is_log2_of_LHS_int_bit_width.zig-2
...@@ -3,8 +3,6 @@ export fn entry(x: u8, y: u8) u8 {...@@ -3,8 +3,6 @@ export fn entry(x: u8, y: u8) u8 {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:17: error: expected type 'u3', found 'u8'7// :2:17: error: expected type 'u3', found 'u8'
10// :2:17: note: unsigned 3-bit int cannot represent all possible unsigned 8-bit values8// :2:17: note: unsigned 3-bit int cannot represent all possible unsigned 8-bit values
test/cases/compile_errors/shifting_without_int_type_or_comptime_known.zig-2
...@@ -16,8 +16,6 @@ export fn entry3() void {...@@ -16,8 +16,6 @@ export fn entry3() void {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be comptime-known20// :2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be comptime-known
23// :5:17: error: LHS of shift must be a fixed-width integer type, or RHS must be comptime-known21// :5:17: error: LHS of shift must be a fixed-width integer type, or RHS must be comptime-known
test/cases/compile_errors/shlExact_shifts_out_1_bits.zig-2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:15: error: overflow of integer type 'u8' with value '340'8// :2:15: error: overflow of integer type 'u8' with value '340'
test/cases/compile_errors/shrExact_shifts_out_1_bits.zig-2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:15: error: exact shift shifted out 1 bits8// :2:15: error: exact shift shifted out 1 bits
test/cases/compile_errors/signed_integer_division.zig-2
...@@ -3,7 +3,5 @@ export fn foo(a: i32, b: i32) i32 {...@@ -3,7 +3,5 @@ export fn foo(a: i32, b: i32) i32 {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact7// :2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact
test/cases/compile_errors/sizeOf_bad_type.zig-2
...@@ -3,7 +3,5 @@ export fn entry() usize {...@@ -3,7 +3,5 @@ export fn entry() usize {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:20: error: no size available for type '@TypeOf(null)'7// :2:20: error: no size available for type '@TypeOf(null)'
test/cases/compile_errors/slice_cannot_have_its_bytes_reinterpreted.zig-2
...@@ -4,7 +4,5 @@ export fn foo() void {...@@ -4,7 +4,5 @@ export fn foo() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:49: error: comptime dereference requires '[]const u8' to have a well-defined layout8// :3:49: error: comptime dereference requires '[]const u8' to have a well-defined layout
test/cases/compile_errors/slice_of_non_array_type.zig-2
...@@ -3,7 +3,5 @@ comptime {...@@ -3,7 +3,5 @@ comptime {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:10: error: slice of non-array type 'comptime_int'7// :2:10: error: slice of non-array type 'comptime_int'
test/cases/compile_errors/slice_of_null_pointer.zig-1
...@@ -6,6 +6,5 @@ comptime {...@@ -6,6 +6,5 @@ comptime {
6}6}
77
8// error8// error
9// target=native
10//9//
11// :5:10: error: slice of null pointer10// :5:10: error: slice of null pointer
test/cases/compile_errors/slice_passed_as_array_init_type.zig-2
...@@ -4,8 +4,6 @@ export fn entry() void {...@@ -4,8 +4,6 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:19: error: type '[]u8' does not support array initialization syntax8// :2:19: error: type '[]u8' does not support array initialization syntax
11// :2:19: note: inferred array length is specified with an underscore: '[_]u8'9// :2:19: note: inferred array length is specified with an underscore: '[_]u8'
test/cases/compile_errors/slice_passed_as_array_init_type_with_elems.zig-2
...@@ -4,8 +4,6 @@ export fn entry() void {...@@ -4,8 +4,6 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:15: error: type '[]u8' does not support array initialization syntax8// :2:15: error: type '[]u8' does not support array initialization syntax
11// :2:15: note: inferred array length is specified with an underscore: '[_]u8'9// :2:15: note: inferred array length is specified with an underscore: '[_]u8'
test/cases/compile_errors/slice_sentinel_mismatch-1.zig-2
...@@ -9,8 +9,6 @@ export fn entry2() void {...@@ -9,8 +9,6 @@ export fn entry2() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :2:37: error: expected type '[2:1]u8', found '[2:2]u8'13// :2:37: error: expected type '[2:1]u8', found '[2:2]u8'
16// :2:37: note: array sentinel '2' cannot cast into array sentinel '1'14// :2:37: note: array sentinel '2' cannot cast into array sentinel '1'
test/cases/compile_errors/slice_sentinel_mismatch-2.zig-2
...@@ -7,8 +7,6 @@ comptime {...@@ -7,8 +7,6 @@ comptime {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :3:12: error: expected type '[:0]u8', found '[]u8'11// :3:12: error: expected type '[:0]u8', found '[]u8'
14// :3:12: note: destination pointer requires '0' sentinel12// :3:12: note: destination pointer requires '0' sentinel
test/cases/compile_errors/slice_to_anyopaque_pointer.zig-2
...@@ -5,8 +5,6 @@ export fn entry() void {...@@ -5,8 +5,6 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:37: error: expected type '*const anyopaque', found '[]const u8'9// :3:37: error: expected type '*const anyopaque', found '[]const u8'
12// :3:37: note: cannot implicitly cast slice '[]const u8' to anyopaque pointer '*const anyopaque'10// :3:37: note: cannot implicitly cast slice '[]const u8' to anyopaque pointer '*const anyopaque'
test/cases/compile_errors/specify_non-integer_enum_tag_type.zig-2
...@@ -10,7 +10,5 @@ export fn entry() void {...@@ -10,7 +10,5 @@ export fn entry() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :1:20: error: expected integer tag type, found 'f32'14// :1:20: error: expected integer tag type, found 'f32'
test/cases/compile_errors/spirv_merge_logical_pointers.zig-1
...@@ -11,7 +11,6 @@ export fn a() void {...@@ -11,7 +11,6 @@ export fn a() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=spirv64-vulkan14// target=spirv64-vulkan
16//15//
17// :9:13: error: value with non-mergable pointer type '*i32' depends on runtime control flow16// :9:13: error: value with non-mergable pointer type '*i32' depends on runtime control flow
test/cases/compile_errors/stage1/obj/call_with_new_stack_on_unsupported_target.zig deleted-11
...@@ -1,11 +0,0 @@
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/cases/compile_errors/stage1/obj/generic_fn_as_parameter_without_comptime_keyword.zig deleted-11
...@@ -1,11 +0,0 @@
1fn f(_: fn (anytype) void) void {}
2fn g(_: anytype) void {}
3export fn entry() void {
4 f(g);
5}
6
7// error
8// backend=stage1
9// target=native
10//
11// tmp.zig:1:9: error: parameter of type 'fn (anytype) anytype' must be declared comptime
test/cases/compile_errors/stage1/obj/generic_function_returning_opaque_type.zig deleted-25
...@@ -1,25 +0,0 @@
1const FooType = opaque {};
2fn generic(comptime T: type) !T {
3 return undefined;
4}
5export fn bar() void {
6 _ = generic(FooType);
7}
8export fn bav() void {
9 _ = generic(@TypeOf(null));
10}
11export fn baz() void {
12 _ = generic(@TypeOf(undefined));
13}
14
15// error
16// backend=stage1
17// target=native
18//
19// tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed
20// tmp.zig:2:1: note: function declared here
21// tmp.zig:1:1: note: type declared here
22// tmp.zig:9:16: error: call to generic function with Null return type '@Type(.Null)' not allowed
23// tmp.zig:2:1: note: function declared here
24// tmp.zig:12:16: error: call to generic function with Undefined return type '@Type(.Undefined)' not allowed
25// tmp.zig:2:1: note: function declared here
test/cases/compile_errors/stage1/obj/generic_function_where_return_type_is_self-referenced.zig deleted-13
...@@ -1,13 +0,0 @@
1fn Foo(comptime T: type) Foo(T) {
2 return struct { x: T };
3}
4export fn entry() void {
5 const t = Foo(u32){ .x = 1 };
6 _ = t;
7}
8
9// error
10// backend=stage1
11// target=native
12//
13// tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches
test/cases/compile_errors/stage1/obj/unsupported_modifier_at_start_of_asm_output_constraint.zig deleted-14
...@@ -1,14 +0,0 @@
1export fn foo() void {
2 var bar: u32 = 3;
3 asm volatile (""
4 : [baz] "+r" (bar),
5 :
6 : ""
7 );
8}
9
10// error
11// backend=stage1
12// target=native
13//
14// 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/cases/compile_errors/stage1/obj/variable_in_inline_assembly_template_cannot_be_found.zig deleted-12
...@@ -1,12 +0,0 @@
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/cases/compile_errors/std.fmt_error_for_unused_arguments.zig-2
...@@ -3,7 +3,5 @@ export fn entry() void {...@@ -3,7 +3,5 @@ export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :?:?: error: 10 unused arguments in '{d} {d} {d} {d} {d}'7// :?:?: error: 10 unused arguments in '{d} {d} {d} {d} {d}'
test/cases/compile_errors/store_vector_pointer_with_unknown_runtime_index.zig-2
...@@ -11,7 +11,5 @@ fn storev(ptr: anytype, val: i31) void {...@@ -11,7 +11,5 @@ fn storev(ptr: anytype, val: i31) void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :10:8: error: unable to determine vector element index of type '*align(16:0:4:?) i31'15// :10:8: error: unable to determine vector element index of type '*align(16:0:4:?) i31'
test/cases/compile_errors/struct_depends_on_itself_via_optional_field.zig-2
...@@ -11,7 +11,5 @@ export fn entry() void {...@@ -11,7 +11,5 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :1:17: error: struct 'tmp.LhsExpr' depends on itself15// :1:17: error: struct 'tmp.LhsExpr' depends on itself
test/cases/compile_errors/struct_duplicate_field_name.zig-1
...@@ -9,7 +9,6 @@ export fn entry() void {...@@ -9,7 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// target=native
13//12//
14// :2:5: error: duplicate struct member name 'foo'13// :2:5: error: duplicate struct member name 'foo'
15// :3:5: note: duplicate name here14// :3:5: note: duplicate name here
test/cases/compile_errors/struct_init_passed_to_type_param.zig-2
...@@ -7,8 +7,6 @@ fn hi(comptime T: type) usize {...@@ -7,8 +7,6 @@ fn hi(comptime T: type) usize {
7export const value = hi(MyStruct{ .x = 12 });7export const value = hi(MyStruct{ .x = 12 });
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :7:33: error: expected type 'type', found 'tmp.MyStruct'11// :7:33: error: expected type 'type', found 'tmp.MyStruct'
14// :1:18: note: struct declared here12// :1:18: note: struct declared here
test/cases/compile_errors/struct_init_syntax_for_array.zig-2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:13: error: initializing array with struct syntax8// :1:13: error: initializing array with struct syntax
test/cases/compile_errors/struct_type_mismatch_in_arg.zig-2
...@@ -9,8 +9,6 @@ comptime {...@@ -9,8 +9,6 @@ comptime {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :7:15: error: expected type 'tmp.Foo', found 'tmp.Bar'13// :7:15: error: expected type 'tmp.Foo', found 'tmp.Bar'
16// :2:13: note: struct declared here14// :2:13: note: struct declared here
test/cases/compile_errors/struct_type_returned_from_non-generic_function.zig-2
...@@ -3,8 +3,6 @@ pub export fn entry(param: usize) usize {...@@ -3,8 +3,6 @@ pub export fn entry(param: usize) usize {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:12: error: expected type 'usize', found 'type'7// :2:12: error: expected type 'usize', found 'type'
10// :1:35: note: function return type declared here8// :1:35: note: function return type declared here
test/cases/compile_errors/struct_with_declarations_unavailable_for_reify_type.zig-2
...@@ -5,7 +5,5 @@ export fn entry() void {...@@ -5,7 +5,5 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :2:9: error: reified structs must have no decls9// :2:9: error: reified structs must have no decls
test/cases/compile_errors/struct_with_invalid_field.zig-2
...@@ -24,7 +24,5 @@ export fn entry() void {...@@ -24,7 +24,5 @@ export fn entry() void {
24}24}
2525
26// error26// error
27// backend=stage2
28// target=native
29//27//
30// :14:17: error: use of undeclared identifier 'HeaderValue'28// :14:17: error: use of undeclared identifier 'HeaderValue'
test/cases/compile_errors/sub_sat_on_undefined_value.zig-2
...@@ -12,8 +12,6 @@ comptime {...@@ -12,8 +12,6 @@ comptime {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :6:5: error: found compile log statement16// :6:5: error: found compile log statement
19//17//
test/cases/compile_errors/sub_wrap_on_undefined_value.zig-2
...@@ -12,8 +12,6 @@ comptime {...@@ -12,8 +12,6 @@ comptime {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :6:5: error: found compile log statement16// :6:5: error: found compile log statement
19//17//
test/cases/compile_errors/switch_capture_incompatible_types.zig-2
...@@ -15,8 +15,6 @@ export fn g() void {...@@ -15,8 +15,6 @@ export fn g() void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :5:20: error: capture group with incompatible types19// :5:20: error: capture group with incompatible types
22// :5:20: note: incompatible types: 'u32' and '*u8'20// :5:20: note: incompatible types: 'u32' and '*u8'
test/cases/compile_errors/switch_expression-duplicate_enumeration_prong.zig-2
...@@ -19,8 +19,6 @@ export fn entry() usize {...@@ -19,8 +19,6 @@ export fn entry() usize {
19}19}
2020
21// error21// error
22// backend=stage2
23// target=native
24//22//
25// :13:15: error: duplicate switch value23// :13:15: error: duplicate switch value
26// :10:15: note: previous value here24// :10:15: note: previous value here
test/cases/compile_errors/switch_expression-duplicate_enumeration_prong_when_else_present.zig-2
...@@ -20,8 +20,6 @@ export fn entry() usize {...@@ -20,8 +20,6 @@ export fn entry() usize {
20}20}
2121
22// error22// error
23// backend=stage2
24// target=native
25//23//
26// :13:15: error: duplicate switch value24// :13:15: error: duplicate switch value
27// :10:15: note: previous value here25// :10:15: note: previous value here
test/cases/compile_errors/switch_expression-duplicate_error_prong.zig-2
...@@ -24,8 +24,6 @@ export fn entry() usize {...@@ -24,8 +24,6 @@ export fn entry() usize {
24}24}
2525
26// error26// error
27// backend=stage2
28// target=native
29//27//
30// :8:9: error: duplicate switch value28// :8:9: error: duplicate switch value
31// :5:9: note: previous value here29// :5:9: note: previous value here
test/cases/compile_errors/switch_expression-duplicate_error_prong_when_else_present.zig-2
...@@ -26,8 +26,6 @@ export fn entry() usize {...@@ -26,8 +26,6 @@ export fn entry() usize {
26}26}
2727
28// error28// error
29// backend=stage2
30// target=native
31//29//
32// :8:9: error: duplicate switch value30// :8:9: error: duplicate switch value
33// :5:9: note: previous value here31// :5:9: note: previous value here
test/cases/compile_errors/switch_expression-duplicate_or_overlapping_integer_value.zig-2
...@@ -11,8 +11,6 @@ export fn entry() usize {...@@ -11,8 +11,6 @@ export fn entry() usize {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :6:12: error: duplicate switch value15// :6:12: error: duplicate switch value
18// :5:17: note: previous value here16// :5:17: note: previous value here
test/cases/compile_errors/switch_expression-duplicate_type.zig-2
...@@ -12,8 +12,6 @@ export fn entry() usize {...@@ -12,8 +12,6 @@ export fn entry() usize {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :6:9: error: duplicate switch value16// :6:9: error: duplicate switch value
19// :4:9: note: previous value here17// :4:9: note: previous value here
test/cases/compile_errors/switch_expression-duplicate_type_struct_alias.zig-2
...@@ -16,8 +16,6 @@ export fn entry() usize {...@@ -16,8 +16,6 @@ export fn entry() usize {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :10:9: error: duplicate switch value20// :10:9: error: duplicate switch value
23// :8:9: note: previous value here21// :8:9: note: previous value here
test/cases/compile_errors/switch_expression-missing_enumeration_prong.zig-2
...@@ -17,8 +17,6 @@ export fn entry() usize {...@@ -17,8 +17,6 @@ export fn entry() usize {
17}17}
1818
19// error19// error
20// backend=stage2
21// target=native
22//20//
23// :8:5: error: switch must handle all possibilities21// :8:5: error: switch must handle all possibilities
24// :5:5: note: unhandled enumeration value: 'Four'22// :5:5: note: unhandled enumeration value: 'Four'
test/cases/compile_errors/switch_expression-missing_error_prong.zig-2
...@@ -24,8 +24,6 @@ export fn entry() usize {...@@ -24,8 +24,6 @@ export fn entry() usize {
24}24}
2525
26// error26// error
27// backend=stage2
28// target=native
29//27//
30// :8:27: error: switch must handle all possibilities28// :8:27: error: switch must handle all possibilities
31// :8:27: note: unhandled error value: 'error.Four'29// :8:27: note: unhandled error value: 'error.Four'
test/cases/compile_errors/switch_expression-multiple_else_prongs.zig-2
...@@ -26,8 +26,6 @@ export fn entry() void {...@@ -26,8 +26,6 @@ export fn entry() void {
26}26}
2727
28// error28// error
29// backend=stage2
30// target=native
31//29//
32// :5:9: error: multiple else prongs in switch expression30// :5:9: error: multiple else prongs in switch expression
33// :4:9: note: previous else prong here31// :4:9: note: previous else prong here
test/cases/compile_errors/switch_expression-non_exhaustive_integer_prongs.zig-2
...@@ -8,7 +8,5 @@ export fn entry() usize {...@@ -8,7 +8,5 @@ export fn entry() usize {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:5: error: switch must handle all possibilities12// :2:5: error: switch must handle all possibilities
test/cases/compile_errors/switch_expression-switch_on_pointer_type_with_no_else.zig-2
...@@ -9,7 +9,5 @@ export fn entry() usize {...@@ -9,7 +9,5 @@ export fn entry() usize {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :2:5: error: else prong required when switching on type '*u8'13// :2:5: error: else prong required when switching on type '*u8'
test/cases/compile_errors/switch_expression-unreachable_else_prong_bool.zig-2
...@@ -10,7 +10,5 @@ export fn entry() usize {...@@ -10,7 +10,5 @@ export fn entry() usize {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :5:14: error: unreachable else prong; all cases already handled14// :5:14: error: unreachable else prong; all cases already handled
test/cases/compile_errors/switch_expression-unreachable_else_prong_enum.zig-2
...@@ -20,7 +20,5 @@ export fn entry() usize {...@@ -20,7 +20,5 @@ export fn entry() usize {
20}20}
2121
22// error22// error
23// backend=stage2
24// target=native
25//23//
26// :14:14: error: unreachable else prong; all cases already handled24// :14:14: error: unreachable else prong; all cases already handled
test/cases/compile_errors/switch_expression-unreachable_else_prong_error.zig-2
...@@ -25,8 +25,6 @@ export fn entry() usize {...@@ -25,8 +25,6 @@ export fn entry() usize {
25}25}
2626
27// error27// error
28// backend=stage2
29// target=native
30//28//
31// :7:14: error: unreachable else prong; all cases already handled29// :7:14: error: unreachable else prong; all cases already handled
32// :17:14: error: unreachable else prong; all cases already handled30// :17:14: error: unreachable else prong; all cases already handled
test/cases/compile_errors/switch_expression-unreachable_else_prong_range_i8.zig-2
...@@ -13,7 +13,5 @@ export fn entry() usize {...@@ -13,7 +13,5 @@ export fn entry() usize {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :8:14: error: unreachable else prong; all cases already handled17// :8:14: error: unreachable else prong; all cases already handled
test/cases/compile_errors/switch_expression-unreachable_else_prong_range_u8.zig-2
...@@ -13,7 +13,5 @@ export fn entry() usize {...@@ -13,7 +13,5 @@ export fn entry() usize {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :8:14: error: unreachable else prong; all cases already handled17// :8:14: error: unreachable else prong; all cases already handled
test/cases/compile_errors/switch_expression-unreachable_else_prong_u1.zig-2
...@@ -10,7 +10,5 @@ export fn entry() usize {...@@ -10,7 +10,5 @@ export fn entry() usize {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :5:14: error: unreachable else prong; all cases already handled14// :5:14: error: unreachable else prong; all cases already handled
test/cases/compile_errors/switch_expression-unreachable_else_prong_u2.zig-2
...@@ -12,7 +12,5 @@ export fn entry() usize {...@@ -12,7 +12,5 @@ export fn entry() usize {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :7:14: error: unreachable else prong; all cases already handled16// :7:14: error: unreachable else prong; all cases already handled
test/cases/compile_errors/switch_on_enum_with_1_field_with_no_prongs.zig-2
...@@ -6,8 +6,6 @@ export fn entry() void {...@@ -6,8 +6,6 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :5:5: error: switch must handle all possibilities10// :5:5: error: switch must handle all possibilities
13// :1:20: note: unhandled enumeration value: 'M'11// :1:20: note: unhandled enumeration value: 'M'
test/cases/compile_errors/switch_on_error_with_1_field_with_no_prongs.zig-2
...@@ -11,8 +11,6 @@ export fn entry2() void {...@@ -11,8 +11,6 @@ export fn entry2() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :5:24: error: switch must handle all possibilities15// :5:24: error: switch must handle all possibilities
18// :5:24: note: unhandled error value: 'error.M'16// :5:24: note: unhandled error value: 'error.M'
test/cases/compile_errors/switch_on_error_with_capture_by_reference.zig-2
...@@ -17,8 +17,6 @@ comptime {...@@ -17,8 +17,6 @@ comptime {
17}17}
1818
19// error19// error
20// backend=stage2
21// target=native
22//20//
23// :4:24: error: error set cannot be captured by reference21// :4:24: error: error set cannot be captured by reference
24// :13:24: error: error set cannot be captured by reference22// :13:24: error: error set cannot be captured by reference
test/cases/compile_errors/switch_on_error_with_non_trivial_switch_operand.zig-2
...@@ -15,8 +15,6 @@ export fn entry2() void {...@@ -15,8 +15,6 @@ export fn entry2() void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :4:42: error: invalid operands to binary expression: 'error_set' and 'comptime_int'19// :4:42: error: invalid operands to binary expression: 'error_set' and 'comptime_int'
22// :12:35: error: invalid operands to binary expression: 'error_set' and 'comptime_int'20// :12:35: error: invalid operands to binary expression: 'error_set' and 'comptime_int'
test/cases/compile_errors/switch_on_non_err_union.zig-1
...@@ -5,7 +5,6 @@ pub fn main() void {...@@ -5,7 +5,6 @@ pub fn main() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=x86_64-linux8// target=x86_64-linux
10//9//
11// :2:23: error: expected error union type, found 'bool'10// :2:23: error: expected error union type, found 'bool'
test/cases/compile_errors/switch_on_slice.zig-2
...@@ -8,7 +8,5 @@ pub export fn entry() void {...@@ -8,7 +8,5 @@ pub export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :4:13: error: switch on type '[:0]const u8'12// :4:13: error: switch on type '[:0]const u8'
test/cases/compile_errors/switch_on_union_with_no_attached_enum.zig-2
...@@ -15,8 +15,6 @@ fn foo(a: *const Payload) void {...@@ -15,8 +15,6 @@ fn foo(a: *const Payload) void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :11:14: error: switch on union with no attached enum19// :11:14: error: switch on union with no attached enum
22// :1:17: note: consider 'union(enum)' here20// :1:17: note: consider 'union(enum)' here
test/cases/compile_errors/switch_ranges_endpoints_are_validated.zig-2
...@@ -14,8 +14,6 @@ pub export fn entr2() void {...@@ -14,8 +14,6 @@ pub export fn entr2() void {
14}14}
1515
16// error16// error
17// backend=stage2
18// target=native
19//17//
20// :4:10: error: range start value is greater than the end value18// :4:10: error: range start value is greater than the end value
21// :11:11: error: range start value is greater than the end value19// :11:11: error: range start value is greater than the end value
test/cases/compile_errors/switch_with_overlapping_case_ranges.zig-2
...@@ -7,8 +7,6 @@ export fn entry() void {...@@ -7,8 +7,6 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :5:10: error: duplicate switch value11// :5:10: error: duplicate switch value
14// :4:10: note: previous value here12// :4:10: note: previous value here
test/cases/compile_errors/switching_with_exhaustive_enum_has___prong_.zig-2
...@@ -12,8 +12,6 @@ pub export fn entry() void {...@@ -12,8 +12,6 @@ pub export fn entry() void {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :7:5: error: '_' prong only allowed when switching on non-exhaustive enums16// :7:5: error: '_' prong only allowed when switching on non-exhaustive enums
19// :10:9: note: '_' prong here17// :10:9: note: '_' prong here
test/cases/compile_errors/switching_with_non-exhaustive_enums.zig-2
...@@ -31,8 +31,6 @@ pub export fn entry3() void {...@@ -31,8 +31,6 @@ pub export fn entry3() void {
31}31}
3232
33// error33// error
34// backend=stage2
35// target=native
36//34//
37// :12:5: error: switch must handle all possibilities35// :12:5: error: switch must handle all possibilities
38// :3:5: note: unhandled enumeration value: 'b'36// :3:5: note: unhandled enumeration value: 'b'
test/cases/compile_errors/tab_inside_comment.zig-2
...@@ -2,7 +2,5 @@...@@ -2,7 +2,5 @@
2export fn entry() void {}2export fn entry() void {}
33
4// error4// error
5// backend=stage2
6// target=native
7//5//
8// :1:8: error: comment contains invalid byte: '\t'6// :1:8: error: comment contains invalid byte: '\t'
test/cases/compile_errors/tab_inside_doc_comment.zig-2
...@@ -2,7 +2,5 @@...@@ -2,7 +2,5 @@
2export fn entry() void {}2export fn entry() void {}
33
4// error4// error
5// backend=stage2
6// target=native
7//5//
8// :1:13: error: comment contains invalid byte: '\t'6// :1:13: error: comment contains invalid byte: '\t'
test/cases/compile_errors/tab_inside_multiline_string.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7 _ = foo;7 _ = foo;
8}8}
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :4:11: error: string literal contains invalid byte: '\t'11// :4:11: error: string literal contains invalid byte: '\t'
test/cases/compile_errors/tab_inside_string.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:18: error: string literal contains invalid byte: '\t'8// :2:18: error: string literal contains invalid byte: '\t'
test/cases/compile_errors/tagName_on_invalid_value_of_non-exhaustive_enum.zig-2
...@@ -4,8 +4,6 @@ test "enum" {...@@ -4,8 +4,6 @@ test "enum" {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9// is_test=true7// is_test=true
10//8//
11// :3:9: error: no field with value '@enumFromInt(5)' in enum 'tmp.test.enum.E'9// :3:9: error: no field with value '@enumFromInt(5)' in enum 'tmp.test.enum.E'
test/cases/compile_errors/tagName_used_on_union_with_no_associated_enum_tag.zig-2
...@@ -8,8 +8,6 @@ export fn entry() void {...@@ -8,8 +8,6 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :7:9: error: union 'tmp.FloatInt' is untagged12// :7:9: error: union 'tmp.FloatInt' is untagged
15// :1:25: note: union declared here13// :1:25: note: union declared here
test/cases/compile_errors/tag_capture_on_non_inline_prong.zig-2
...@@ -8,7 +8,5 @@ pub export fn entry() void {...@@ -8,7 +8,5 @@ pub export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :5:26: error: tag capture on non-inline prong12// :5:26: error: tag capture on non-inline prong
test/cases/compile_errors/take_slice_of_invalid_dereference.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:18: error: cannot dereference non-pointer type 'comptime_int'8// :2:18: error: cannot dereference non-pointer type 'comptime_int'
test/cases/compile_errors/threadlocal_qualifier_on_const.zig-2
...@@ -4,7 +4,5 @@ export fn entry() i32 {...@@ -4,7 +4,5 @@ export fn entry() i32 {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:1: error: threadlocal variable cannot be constant8// :1:1: error: threadlocal variable cannot be constant
test/cases/compile_errors/too_big_packed_struct.zig-2
...@@ -7,7 +7,5 @@ pub export fn entry() void {...@@ -7,7 +7,5 @@ pub export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :2:22: error: size of packed struct '131070' exceeds maximum bit width of 6553511// :2:22: error: size of packed struct '131070' exceeds maximum bit width of 65535
test/cases/compile_errors/top_level_decl_dependency_loop.zig-2
...@@ -6,7 +6,5 @@ export fn entry() void {...@@ -6,7 +6,5 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :1:1: error: dependency loop detected10// :1:1: error: dependency loop detected
test/cases/compile_errors/truncate_sign_mismatch.zig-2
...@@ -16,8 +16,6 @@ export fn entry4() u8 {...@@ -16,8 +16,6 @@ export fn entry4() u8 {
16}16}
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :3:26: error: expected signed integer type, found 'u32'20// :3:26: error: expected signed integer type, found 'u32'
23// :7:26: error: expected unsigned integer type, found 'i32'21// :7:26: error: expected unsigned integer type, found 'i32'
test/cases/compile_errors/try_in_function_with_non_error_return_type.zig-2
...@@ -4,8 +4,6 @@ export fn f() void {...@@ -4,8 +4,6 @@ export fn f() void {
4fn something() anyerror!void {}4fn something() anyerror!void {}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:5: error: expected type 'void', found 'anyerror'8// :2:5: error: expected type 'void', found 'anyerror'
11// :1:15: note: function cannot return an error9// :1:15: note: function cannot return an error
test/cases/compile_errors/try_return.zig-2
...@@ -4,8 +4,6 @@ pub fn foo() !void {...@@ -4,8 +4,6 @@ pub fn foo() !void {
4pub fn bar() !void {}4pub fn bar() !void {}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:5: error: unreachable code8// :2:5: error: unreachable code
11// :2:9: note: control flow is diverted here9// :2:9: note: control flow is diverted here
test/cases/compile_errors/tuple_declarations.zig-2
...@@ -16,8 +16,6 @@ const T = struct {...@@ -16,8 +16,6 @@ const T = struct {
16};16};
1717
18// error18// error
19// backend=stage2
20// target=native
21//19//
22// :2:5: error: enum field missing name20// :2:5: error: enum field missing name
23// :5:5: error: union field missing name21// :5:5: error: union field missing name
test/cases/compile_errors/tuple_init_edge_cases.zig-2
...@@ -66,8 +66,6 @@ pub export fn entry6() void {...@@ -66,8 +66,6 @@ pub export fn entry6() void {
66}66}
6767
68// error68// error
69// backend=stage2
70// target=native
71//69//
72// :18:14: error: missing tuple field with index 170// :18:14: error: missing tuple field with index 1
73// :25:14: error: missing tuple field with index 171// :25:14: error: missing tuple field with index 1
test/cases/compile_errors/tuple_ptr_to_mut_slice.zig-2
...@@ -19,8 +19,6 @@ export fn entry4() void {...@@ -19,8 +19,6 @@ export fn entry4() void {
19}19}
2020
21// error21// error
22// backend=stage2
23// target=native
24//22//
25// :3:19: error: cannot cast pointer to tuple to '[]u8'23// :3:19: error: cannot cast pointer to tuple to '[]u8'
26// :3:19: note: pointers to tuples can only coerce to constant pointers24// :3:19: note: pointers to tuples can only coerce to constant pointers
test/cases/compile_errors/type_checking_function_pointers.zig-2
...@@ -9,8 +9,6 @@ export fn entry() void {...@@ -9,8 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :8:7: error: expected type '*const fn (*const u8) void', found '*const fn (u8) void'13// :8:7: error: expected type '*const fn (*const u8) void', found '*const fn (u8) void'
16// :8:7: note: pointer type child 'fn (u8) void' cannot cast into pointer type child 'fn (*const u8) void'14// :8:7: note: pointer type child 'fn (u8) void' cannot cast into pointer type child 'fn (*const u8) void'
test/cases/compile_errors/type_error_in_implicit_return.zig-2
...@@ -8,8 +8,6 @@ pub export fn entry() void {...@@ -8,8 +8,6 @@ pub export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :1:16: error: function with non-void return type 'u32' implicitly returns12// :1:16: error: function with non-void return type 'u32' implicitly returns
15// :3:1: note: control flow reaches end of body here13// :3:1: note: control flow reaches end of body here
test/cases/compile_errors/type_mismatch_in_C_prototype_with_varargs.zig-2
...@@ -7,8 +7,6 @@ export fn main() void {...@@ -7,8 +7,6 @@ export fn main() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :5:22: error: expected type '?fn ([*c]u8, ...) callconv(.c) void', found 'fn ([*:0]u8, ...) callconv(.c) void'11// :5:22: error: expected type '?fn ([*c]u8, ...) callconv(.c) void', found 'fn ([*:0]u8, ...) callconv(.c) void'
14// :5:22: note: parameter 0 '[*:0]u8' cannot cast into '[*c]u8'12// :5:22: note: parameter 0 '[*:0]u8' cannot cast into '[*c]u8'
test/cases/compile_errors/type_mismatch_with_tuple_concatenation.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:11: error: expected type '@TypeOf(.{})', found 'struct { comptime comptime_int = 1, comptime comptime_int = 2, comptime comptime_int = 3 }'8// :3:11: error: expected type '@TypeOf(.{})', found 'struct { comptime comptime_int = 1, comptime comptime_int = 2, comptime comptime_int = 3 }'
test/cases/compile_errors/type_variables_must_be_constant.zig-2
...@@ -4,8 +4,6 @@ export fn entry() foo {...@@ -4,8 +4,6 @@ export fn entry() foo {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :1:11: error: variable of type 'type' must be const or comptime8// :1:11: error: variable of type 'type' must be const or comptime
11// :1:11: note: types are not available at runtime9// :1:11: note: types are not available at runtime
test/cases/compile_errors/undeclared_identifier.zig-2
...@@ -3,7 +3,5 @@ export fn a() void {...@@ -3,7 +3,5 @@ export fn a() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:12: error: use of undeclared identifier 'b'7// :2:12: error: use of undeclared identifier 'b'
test/cases/compile_errors/undeclared_identifier_error_should_mark_fn_as_impure.zig-2
...@@ -6,7 +6,5 @@ fn test_a_thing() void {...@@ -6,7 +6,5 @@ fn test_a_thing() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :5:5: error: use of undeclared identifier 'bad_fn_call'10// :5:5: error: use of undeclared identifier 'bad_fn_call'
test/cases/compile_errors/undeclared_identifier_in_unanalyzed_branch.zig-2
...@@ -5,7 +5,5 @@ export fn a() void {...@@ -5,7 +5,5 @@ export fn a() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :3:9: error: use of undeclared identifier 'lol_this_doesnt_exist'9// :3:9: error: use of undeclared identifier 'lol_this_doesnt_exist'
test/cases/compile_errors/undefined_function_call.zig-2
...@@ -3,7 +3,5 @@ export fn a() void {...@@ -3,7 +3,5 @@ export fn a() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:5: error: use of undeclared identifier 'b'7// :2:5: error: use of undeclared identifier 'b'
test/cases/compile_errors/underscore_is_not_a_declarable_symbol.zig-2
...@@ -4,7 +4,5 @@ export fn f1() usize {...@@ -4,7 +4,5 @@ export fn f1() usize {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:9: error: '_' used as an identifier without @"_" syntax8// :2:9: error: '_' used as an identifier without @"_" syntax
test/cases/compile_errors/underscore_should_not_be_usable_inside_for.zig-2
...@@ -7,7 +7,5 @@ export fn returns() void {...@@ -7,7 +7,5 @@ export fn returns() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :4:20: error: '_' used as an identifier without @"_" syntax11// :4:20: error: '_' used as an identifier without @"_" syntax
test/cases/compile_errors/underscore_should_not_be_usable_inside_while.zig-2
...@@ -10,7 +10,5 @@ fn optionalReturn() ?u32 {...@@ -10,7 +10,5 @@ fn optionalReturn() ?u32 {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :4:20: error: '_' used as an identifier without @"_" syntax14// :4:20: error: '_' used as an identifier without @"_" syntax
test/cases/compile_errors/underscore_should_not_be_usable_inside_while_else.zig-2
...@@ -12,7 +12,5 @@ fn optionalReturnError() !?u32 {...@@ -12,7 +12,5 @@ fn optionalReturnError() !?u32 {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :6:17: error: '_' used as an identifier without @"_" syntax16// :6:17: error: '_' used as an identifier without @"_" syntax
test/cases/compile_errors/unhandled_enum_value_in_switch_with_enum_declared_in_other_file.zig-2
...@@ -6,8 +6,6 @@ pub export fn entry1() void {...@@ -6,8 +6,6 @@ pub export fn entry1() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :5:5: error: switch must handle all possibilities10// :5:5: error: switch must handle all possibilities
13// :?:?: note: unhandled enumeration value: 'gt'11// :?:?: note: unhandled enumeration value: 'gt'
test/cases/compile_errors/union_access_of_inactive_field.zig-1
...@@ -10,7 +10,6 @@ comptime {...@@ -10,7 +10,6 @@ comptime {
10}10}
1111
12// error12// error
13// target=native
14//13//
15// :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
16// :1:11: note: union declared here15// :1:11: note: union declared here
test/cases/compile_errors/union_auto-enum_value_already_taken.zig-2
...@@ -11,8 +11,6 @@ export fn entry() void {...@@ -11,8 +11,6 @@ export fn entry() void {
11}11}
1212
13// error13// error
14// backend=stage2
15// target=native
16//14//
17// :6:9: error: enum tag value 60 already taken15// :6:9: error: enum tag value 60 already taken
18// :4:9: note: other occurrence here16// :4:9: note: other occurrence here
test/cases/compile_errors/union_calling_inactive_field_as_fn.zig-2
...@@ -9,8 +9,6 @@ export fn entry() void {...@@ -9,8 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :8:10: error: access of union field 'float' while field 'int' is active13// :8:10: error: access of union field 'float' while field 'int' is active
16// :1:11: note: union declared here14// :1:11: note: union declared here
test/cases/compile_errors/union_duplicate_enum_field.zig-1
...@@ -10,7 +10,6 @@ export fn foo() void {...@@ -10,7 +10,6 @@ export fn foo() void {
10}10}
1111
12// error12// error
13// target=native
14//13//
15// :3:5: error: duplicate union member name 'a'14// :3:5: error: duplicate union member name 'a'
16// :4:5: note: duplicate name here15// :4:5: note: duplicate name here
test/cases/compile_errors/union_duplicate_field_definition.zig-1
...@@ -9,7 +9,6 @@ export fn entry() void {...@@ -9,7 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// target=native
13//12//
14// :2:5: error: duplicate union member name 'foo'13// :2:5: error: duplicate union member name 'foo'
15// :3:5: note: duplicate name here14// :3:5: note: duplicate name here
test/cases/compile_errors/union_enum_field_does_not_match_enum.zig-2
...@@ -15,8 +15,6 @@ export fn entry() void {...@@ -15,8 +15,6 @@ export fn entry() void {
15}15}
1616
17// error17// error
18// backend=stage2
19// target=native
20//18//
21// :10:5: error: no field named 'D' in enum 'tmp.Letter'19// :10:5: error: no field named 'D' in enum 'tmp.Letter'
22// :1:16: note: enum declared here20// :1:16: note: enum declared here
test/cases/compile_errors/union_enum_field_missing.zig-1
...@@ -14,7 +14,6 @@ export fn entry() usize {...@@ -14,7 +14,6 @@ export fn entry() usize {
14}14}
1515
16// error16// error
17// target=native
18//17//
19// :7:11: error: enum field(s) missing in union18// :7:11: error: enum field(s) missing in union
20// :4:5: note: field 'c' missing, declared here19// :4:5: note: field 'c' missing, declared here
test/cases/compile_errors/union_extra_field.zig-1
...@@ -14,7 +14,6 @@ export fn entry() usize {...@@ -14,7 +14,6 @@ export fn entry() usize {
14}14}
1515
16// error16// error
17// target=native
18//17//
19// :10:5: error: no field named 'd' in enum 'tmp.E'18// :10:5: error: no field named 'd' in enum 'tmp.E'
20// :1:11: note: enum declared here19// :1:11: note: enum declared here
test/cases/compile_errors/union_fields_are_resolved_before_tag_type_is_needed.zig-2
...@@ -9,8 +9,6 @@ pub export fn entry() void {...@@ -9,8 +9,6 @@ pub export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :8:8: error: no field or member function named 'f' in '@typeInfo(tmp.T).@"union".tag_type.?'13// :8:8: error: no field or member function named 'f' in '@typeInfo(tmp.T).@"union".tag_type.?'
16// :1:11: note: enum declared here14// :1:11: note: enum declared here
test/cases/compile_errors/union_init_with_non_type_as_first_param.zig-2
...@@ -3,7 +3,5 @@ export fn u() void {...@@ -3,7 +3,5 @@ export fn u() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:20: error: expected type 'type', found 'comptime_int'7// :2:20: error: expected type 'type', found 'comptime_int'
test/cases/compile_errors/union_init_with_none_or_multiple_fields.zig-2
...@@ -24,8 +24,6 @@ export fn u2m() void {...@@ -24,8 +24,6 @@ export fn u2m() void {
24}24}
2525
26// error26// error
27// backend=stage2
28// target=native
29//27//
30// :10:20: error: union initializer must initialize one field28// :10:20: error: union initializer must initialize one field
31// :14:20: error: cannot initialize multiple union fields at once; unions can only have one active field29// :14:20: error: cannot initialize multiple union fields at once; unions can only have one active field
test/cases/compile_errors/union_init_with_struct_as_first_param.zig-2
...@@ -7,8 +7,6 @@ export fn u() void {...@@ -7,8 +7,6 @@ export fn u() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :6:20: error: expected union type, found 'tmp.S'11// :6:20: error: expected union type, found 'tmp.S'
14// :1:11: note: struct declared here12// :1:11: note: struct declared here
test/cases/compile_errors/union_noreturn_field_initialized.zig-2
...@@ -29,8 +29,6 @@ pub export fn entry3() void {...@@ -29,8 +29,6 @@ pub export fn entry3() void {
29}29}
3030
31// error31// error
32// backend=stage2
33// target=native
34//32//
35// :11:14: error: cannot initialize 'noreturn' field of union33// :11:14: error: cannot initialize 'noreturn' field of union
36// :4:9: note: field 'b' declared here34// :4:9: note: field 'b' declared here
test/cases/compile_errors/union_runtime_coercion_from_enum.zig-1
...@@ -15,7 +15,6 @@ export fn doTheTest() u64 {...@@ -15,7 +15,6 @@ export fn doTheTest() u64 {
15}15}
1616
17// error17// error
18// target=native
19//18//
20// :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields19// :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields
21// :6:5: note: field 'a' has type 'u32'20// :6:5: note: field 'a' has type 'u32'
test/cases/compile_errors/union_with_specified_enum_omits_field.zig-2
...@@ -12,8 +12,6 @@ export fn entry() usize {...@@ -12,8 +12,6 @@ export fn entry() usize {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :6:17: error: enum field(s) missing in union16// :6:17: error: enum field(s) missing in union
19// :4:5: note: field 'C' missing, declared here17// :4:5: note: field 'C' missing, declared here
test/cases/compile_errors/union_with_too_small_explicit_signed_tag_type.zig-2
...@@ -9,8 +9,6 @@ export fn entry() void {...@@ -9,8 +9,6 @@ export fn entry() void {
9}9}
1010
11// error11// error
12// backend=stage2
13// target=native
14//12//
15// :1:22: error: specified integer tag type cannot represent every field13// :1:22: error: specified integer tag type cannot represent every field
16// :1:22: note: type 'i2' cannot fit values in range 0...314// :1:22: note: type 'i2' cannot fit values in range 0...3
test/cases/compile_errors/union_with_too_small_explicit_unsigned_tag_type.zig-2
...@@ -10,8 +10,6 @@ export fn entry() void {...@@ -10,8 +10,6 @@ export fn entry() void {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :1:22: error: specified integer tag type cannot represent every field14// :1:22: error: specified integer tag type cannot represent every field
17// :1:22: note: type 'u2' cannot fit values in range 0...415// :1:22: note: type 'u2' cannot fit values in range 0...4
test/cases/compile_errors/unknown_length_pointer_to_opaque.zig-2
...@@ -1,7 +1,5 @@...@@ -1,7 +1,5 @@
1export const T = [*]opaque {};1export const T = [*]opaque {};
22
3// error3// error
4// backend=stage2
5// target=native
6//4//
7// :1:21: error: unknown-length pointer to opaque not allowed5// :1:21: error: unknown-length pointer to opaque not allowed
test/cases/compile_errors/unreachable_code-double_break.zig-2
...@@ -6,8 +6,6 @@ export fn a() void {...@@ -6,8 +6,6 @@ export fn a() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :3:9: error: unreachable code10// :3:9: error: unreachable code
13// :3:20: note: control flow is diverted here11// :3:20: note: control flow is diverted here
test/cases/compile_errors/unreachable_code-nested_returns.zig-2
...@@ -3,8 +3,6 @@ export fn a() i32 {...@@ -3,8 +3,6 @@ export fn a() i32 {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:5: error: unreachable code7// :2:5: error: unreachable code
10// :2:12: note: control flow is diverted here8// :2:12: note: control flow is diverted here
test/cases/compile_errors/unreachable_code.zig-2
...@@ -6,8 +6,6 @@ export fn a() void {...@@ -6,8 +6,6 @@ export fn a() void {
6fn b() void {}6fn b() void {}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :3:6: error: unreachable code10// :3:6: error: unreachable code
13// :2:5: note: control flow is diverted here11// :2:5: note: control flow is diverted here
test/cases/compile_errors/unreachable_else_prong_err_set.zig-2
...@@ -21,7 +21,5 @@ pub export fn simple() void {...@@ -21,7 +21,5 @@ pub export fn simple() void {
21}21}
2222
23// error23// error
24// backend=stage2
25// target=native
26//24//
27// :7:14: error: unreachable else prong; all cases already handled25// :7:14: error: unreachable else prong; all cases already handled
test/cases/compile_errors/unreachable_in_naked_func.zig-2
...@@ -19,8 +19,6 @@ comptime {...@@ -19,8 +19,6 @@ comptime {
19}19}
2020
21// error21// error
22// backend=stage2
23// target=native
24//22//
25// :2:5: error: runtime safety check not allowed in naked function23// :2:5: error: runtime safety check not allowed in naked function
26// :2:5: note: use @setRuntimeSafety to disable runtime safety24// :2:5: note: use @setRuntimeSafety to disable runtime safety
test/cases/compile_errors/unreachable_parameter.zig-2
...@@ -6,7 +6,5 @@ export fn entry() void {...@@ -6,7 +6,5 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :1:6: error: parameter of type 'noreturn' not allowed10// :1:6: error: parameter of type 'noreturn' not allowed
test/cases/compile_errors/unreachable_variable.zig-2
...@@ -4,7 +4,5 @@ export fn f() void {...@@ -4,7 +4,5 @@ export fn f() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:25: error: cannot cast to noreturn8// :2:25: error: cannot cast to noreturn
test/cases/compile_errors/unreachable_with_return.zig-2
...@@ -6,8 +6,6 @@ export fn entry() void {...@@ -6,8 +6,6 @@ export fn entry() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:5: error: function declared 'noreturn' returns10// :2:5: error: function declared 'noreturn' returns
13// :1:8: note: 'noreturn' declared here11// :1:8: note: 'noreturn' declared here
test/cases/compile_errors/untagged_union_integer_conversion.zig-2
...@@ -4,8 +4,6 @@ comptime {...@@ -4,8 +4,6 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:18: error: untagged union 'tmp.UntaggedUnion' cannot be converted to integer8// :3:18: error: untagged union 'tmp.UntaggedUnion' cannot be converted to integer
11// :1:23: note: union declared here9// :1:23: note: union declared here
test/cases/compile_errors/unused_value_in_switch_in_loop.zig-2
...@@ -8,8 +8,6 @@ export fn entry() void {...@@ -8,8 +8,6 @@ export fn entry() void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :3:18: error: incompatible types: 'comptime_int' and 'void'12// :3:18: error: incompatible types: 'comptime_int' and 'void'
15// :4:14: note: type 'comptime_int' here13// :4:14: note: type 'comptime_int' here
test/cases/compile_errors/unused_variable_error_on_errdefer.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :2:15: error: unused capture11// :2:15: error: unused capture
test/cases/compile_errors/use_anyopaque_as_return_type_of_fn_ptr.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:20: error: opaque return type 'anyopaque' not allowed8// :2:20: error: opaque return type 'anyopaque' not allowed
test/cases/compile_errors/use_implicit_casts_to_assign_null_to_non-nullable_pointer.zig-2
...@@ -7,8 +7,6 @@ export fn entry() void {...@@ -7,8 +7,6 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :4:24: error: expected type '*?*i32', found '**i32'11// :4:24: error: expected type '*?*i32', found '**i32'
14// :4:24: note: pointer type child '*i32' cannot cast into pointer type child '?*i32'12// :4:24: note: pointer type child '*i32' cannot cast into pointer type child '?*i32'
test/cases/compile_errors/use_invalid_number_literal_as_array_index.zig-2
...@@ -5,8 +5,6 @@ export fn entry() void {...@@ -5,8 +5,6 @@ export fn entry() void {
5}5}
66
7// error7// error
8// backend=stage2
9// target=native
10//8//
11// :1:9: error: variable of type 'comptime_int' must be const or comptime9// :1:9: error: variable of type 'comptime_int' must be const or comptime
12// :1:9: note: to modify this variable at runtime, it must be given an explicit fixed-size number type10// :1:9: note: to modify this variable at runtime, it must be given an explicit fixed-size number type
test/cases/compile_errors/use_of_undeclared_identifier.zig-2
...@@ -3,7 +3,5 @@ export fn f() void {...@@ -3,7 +3,5 @@ export fn f() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:5: error: use of undeclared identifier 'b'7// :2:5: error: use of undeclared identifier 'b'
test/cases/compile_errors/using_an_unknown_len_ptr_type_instead_of_array.zig-2
...@@ -7,7 +7,5 @@ comptime {...@@ -7,7 +7,5 @@ comptime {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :1:21: error: type '[*][*]const u8' does not support array initialization syntax11// :1:21: error: type '[*][*]const u8' does not support array initialization syntax
test/cases/compile_errors/variable_has_wrong_type.zig-2
...@@ -4,8 +4,6 @@ export fn f() i32 {...@@ -4,8 +4,6 @@ export fn f() i32 {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:12: error: expected type 'i32', found '*const [1:0]u8'8// :3:12: error: expected type 'i32', found '*const [1:0]u8'
11// :1:15: note: function return type declared here9// :1:15: note: function return type declared here
test/cases/compile_errors/variable_initialization_compile_error_then_referenced.zig-2
...@@ -13,7 +13,5 @@ export fn entry() void {...@@ -13,7 +13,5 @@ export fn entry() void {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :2:12: error: use of undeclared identifier 'T'17// :2:12: error: use of undeclared identifier 'T'
test/cases/compile_errors/variable_with_type_noreturn.zig-2
...@@ -4,8 +4,6 @@ export fn entry9() void {...@@ -4,8 +4,6 @@ export fn entry9() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:5: error: unreachable code8// :2:5: error: unreachable code
11// :2:23: note: control flow is diverted here9// :2:23: note: control flow is diverted here
test/cases/compile_errors/variadic_arg_validation.zig-2
...@@ -19,8 +19,6 @@ pub export fn entry3() void {...@@ -19,8 +19,6 @@ pub export fn entry3() void {
19}19}
2020
21// error21// error
22// backend=stage2
23// target=native
24//22//
25// :4:33: error: integer and float literals passed to variadic function must be casted to a fixed-size number type23// :4:33: error: integer and float literals passed to variadic function must be casted to a fixed-size number type
26// :9:24: error: arrays must be passed by reference to variadic function24// :9:24: error: arrays must be passed by reference to variadic function
test/cases/compile_errors/vector_index_out_of_bounds.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:30: error: expected 3 vector elements; found 48// :2:30: error: expected 3 vector elements; found 4
test/cases/compile_errors/volatile_on_global_assembly.zig-2
...@@ -3,7 +3,5 @@ comptime {...@@ -3,7 +3,5 @@ comptime {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:9: error: volatile is meaningless on global assembly7// :2:9: error: volatile is meaningless on global assembly
test/cases/compile_errors/wasmMemoryGrow_is_a_compile_error_in_non-Wasm_targets.zig-1
...@@ -4,7 +4,6 @@ export fn foo() void {...@@ -4,7 +4,6 @@ export fn foo() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=x86_64-native7// target=x86_64-native
9//8//
10// :2:9: error: builtin @wasmMemoryGrow is available when targeting WebAssembly; targeted CPU architecture is x86_649// :2:9: error: builtin @wasmMemoryGrow is available when targeting WebAssembly; targeted CPU architecture is x86_64
test/cases/compile_errors/wasmMemorySize_is_a_compile_error_in_non-Wasm_targets.zig-1
...@@ -4,7 +4,6 @@ export fn foo() void {...@@ -4,7 +4,6 @@ export fn foo() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=x86_64-native7// target=x86_64-native
9//8//
10// :2:9: error: builtin @wasmMemorySize is available when targeting WebAssembly; targeted CPU architecture is x86_649// :2:9: error: builtin @wasmMemorySize is available when targeting WebAssembly; targeted CPU architecture is x86_64
test/cases/compile_errors/while_expected_bool_got_error_union.zig-2
...@@ -6,7 +6,5 @@ fn bar() anyerror!i32 {...@@ -6,7 +6,5 @@ fn bar() anyerror!i32 {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:15: error: expected type 'bool', found 'anyerror!i32'10// :2:15: error: expected type 'bool', found 'anyerror!i32'
test/cases/compile_errors/while_expected_bool_got_optional.zig-2
...@@ -6,7 +6,5 @@ fn bar() ?i32 {...@@ -6,7 +6,5 @@ fn bar() ?i32 {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :2:15: error: expected type 'bool', found '?i32'10// :2:15: error: expected type 'bool', found '?i32'
test/cases/compile_errors/while_expected_error_union_got_bool.zig-2
...@@ -10,7 +10,5 @@ fn bar() bool {...@@ -10,7 +10,5 @@ fn bar() bool {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :2:15: error: expected error union type, found 'bool'14// :2:15: error: expected error union type, found 'bool'
test/cases/compile_errors/while_expected_error_union_got_optional.zig-2
...@@ -10,7 +10,5 @@ fn bar() ?i32 {...@@ -10,7 +10,5 @@ fn bar() ?i32 {
10}10}
1111
12// error12// error
13// backend=stage2
14// target=native
15//13//
16// :2:15: error: expected error union type, found '?i32'14// :2:15: error: expected error union type, found '?i32'
test/cases/compile_errors/while_expected_optional_got_bool.zig-2
...@@ -8,7 +8,5 @@ fn bar() bool {...@@ -8,7 +8,5 @@ fn bar() bool {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:15: error: expected optional type, found 'bool'12// :2:15: error: expected optional type, found 'bool'
test/cases/compile_errors/while_expected_optional_got_error_union.zig-2
...@@ -8,8 +8,6 @@ fn bar() anyerror!i32 {...@@ -8,8 +8,6 @@ fn bar() anyerror!i32 {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:15: error: expected optional type, found 'anyerror!i32'12// :2:15: error: expected optional type, found 'anyerror!i32'
15// :2:15: note: consider using 'try', 'catch', or 'if'13// :2:15: note: consider using 'try', 'catch', or 'if'
test/cases/compile_errors/while_loop_body_expression_ignored.zig-2
...@@ -27,8 +27,6 @@ export fn f5() void {...@@ -27,8 +27,6 @@ export fn f5() void {
27}27}
2828
29// error29// error
30// backend=stage2
31// target=native
32//30//
33// :5:25: error: value of type 'usize' ignored31// :5:25: error: value of type 'usize' ignored
34// :5:25: note: all non-void values must be used32// :5:25: note: all non-void values must be used
test/cases/compile_errors/while_loop_break_value_ignored.zig-2
...@@ -21,8 +21,6 @@ export fn f2() void {...@@ -21,8 +21,6 @@ export fn f2() void {
21}21}
2222
23// error23// error
24// backend=stage2
25// target=native
26//24//
27// :7:5: error: incompatible types: 'usize' and 'void'25// :7:5: error: incompatible types: 'usize' and 'void'
28// :8:22: note: type 'usize' here26// :8:22: note: type 'usize' here
test/cases/compile_errors/write_to_const_global_variable.zig-2
...@@ -7,7 +7,5 @@ export fn entry() void {...@@ -7,7 +7,5 @@ export fn entry() void {
7}7}
88
9// error9// error
10// backend=stage2
11// target=native
12//10//
13// :3:5: error: cannot assign to constant11// :3:5: error: cannot assign to constant
test/cases/compile_errors/wrong_function_type.zig-2
...@@ -13,8 +13,6 @@ export fn entry() usize {...@@ -13,8 +13,6 @@ export fn entry() usize {
13}13}
1414
15// error15// error
16// backend=stage2
17// target=native
18//16//
19// :1:28: error: expected type 'fn () void', found 'fn () i32'17// :1:28: error: expected type 'fn () void', found 'fn () i32'
20// :1:28: note: return type 'i32' cannot cast into return type 'void'18// :1:28: note: return type 'i32' cannot cast into return type 'void'
test/cases/compile_errors/wrong_number_of_arguments.zig-2
...@@ -8,8 +8,6 @@ fn c(d: i32, e: i32, f: i32) void {...@@ -8,8 +8,6 @@ fn c(d: i32, e: i32, f: i32) void {
8}8}
99
10// error10// error
11// backend=stage2
12// target=native
13//11//
14// :2:5: error: expected 3 argument(s), found 112// :2:5: error: expected 3 argument(s), found 1
15// :4:1: note: function declared here13// :4:1: note: function declared here
test/cases/compile_errors/wrong_number_of_arguments_for_method_fn_call.zig-2
...@@ -12,8 +12,6 @@ export fn entry() usize {...@@ -12,8 +12,6 @@ export fn entry() usize {
12}12}
1313
14// error14// error
15// backend=stage2
16// target=native
17//15//
18// :8:8: error: member function expected 1 argument(s), found 216// :8:8: error: member function expected 1 argument(s), found 2
19// :2:5: note: function declared here17// :2:5: note: function declared here
test/cases/compile_errors/wrong_pointer_coerced_to_pointer_to_opaque_{}.zig-2
...@@ -6,8 +6,6 @@ export fn foo() void {...@@ -6,8 +6,6 @@ export fn foo() void {
6}6}
77
8// error8// error
9// backend=stage2
10// target=native
11//9//
12// :5:9: error: expected type '*tmp.Derp', found '*anyopaque'10// :5:9: error: expected type '*tmp.Derp', found '*anyopaque'
13// :5:9: note: pointer type child 'anyopaque' cannot cast into pointer type child 'tmp.Derp'11// :5:9: note: pointer type child 'anyopaque' cannot cast into pointer type child 'tmp.Derp'
test/cases/compile_errors/wrong_size_to_an_array_literal.zig-2
...@@ -4,7 +4,5 @@ comptime {...@@ -4,7 +4,5 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :2:24: error: expected 2 array elements; found 38// :2:24: error: expected 2 array elements; found 3
test/cases/compile_errors/wrong_type_for_reify_type.zig-2
...@@ -3,8 +3,6 @@ export fn entry() void {...@@ -3,8 +3,6 @@ export fn entry() void {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:15: error: expected type 'builtin.Type', found 'comptime_int'7// :2:15: error: expected type 'builtin.Type', found 'comptime_int'
10// :?:?: note: union declared here8// :?:?: note: union declared here
test/cases/compile_errors/wrong_type_passed_to_panic.zig-2
...@@ -4,7 +4,5 @@ export fn entry() void {...@@ -4,7 +4,5 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:12: error: expected type '[]const u8', found 'error{Foo}'8// :3:12: error: expected type '[]const u8', found 'error{Foo}'
test/cases/compile_errors/wrong_type_to_hasField.zig-2
...@@ -3,7 +3,5 @@ export fn entry() bool {...@@ -3,7 +3,5 @@ export fn entry() bool {
3}3}
44
5// error5// error
6// backend=stage2
7// target=native
8//6//
9// :2:22: error: type 'i32' does not support '@hasField'7// :2:22: error: type 'i32' does not support '@hasField'
test/cases/compile_errors/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig-2
...@@ -4,8 +4,6 @@ export fn entry() void {...@@ -4,8 +4,6 @@ export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:47: error: expected type 'builtin.AtomicOrder', found 'u32'8// :3:47: error: expected type 'builtin.AtomicOrder', found 'u32'
11// :?:?: note: enum declared here9// :?:?: note: enum declared here
test/cases/compile_errors/wrong_types_given_to_export.zig-2
...@@ -4,8 +4,6 @@ comptime {...@@ -4,8 +4,6 @@ comptime {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:42: error: expected type 'builtin.GlobalLinkage', found 'u32'8// :3:42: error: expected type 'builtin.GlobalLinkage', found 'u32'
11// :?:?: note: enum declared here9// :?:?: note: enum declared here
test/cases/compile_errors/zero-bit_generic_args_are_coerced_to_param_type.zig-2
...@@ -4,8 +4,6 @@ pub export fn entry() void {...@@ -4,8 +4,6 @@ pub export fn entry() void {
4}4}
55
6// error6// error
7// backend=stage2
8// target=native
9//7//
10// :3:21: error: expected type 'u0', found '*const [4:0]u8'8// :3:21: error: expected type 'u0', found '*const [4:0]u8'
11// :1:23: note: parameter type declared here9// :1:23: note: parameter type declared here
test/cases/dereferencing_though_multiple_pointers_with_address_spaces.zig created+12
...@@ -0,0 +1,12 @@
1fn entry(a: *addrspace(.fs) *addrspace(.gs) *i32) *i32 {
2 return a.*.*;
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=selfhosted,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/error_in_nested_declaration.zig+1-2
...@@ -23,8 +23,7 @@ pub export fn entry2() void {...@@ -23,8 +23,7 @@ pub export fn entry2() void {
23}23}
2424
25// error25// error
26// backend=stage2,llvm26// backend=selfhosted,llvm
27// target=native
28//27//
29// :6:20: error: cannot @bitCast to '[]i32'28// :6:20: error: cannot @bitCast to '[]i32'
30// :6:20: note: use @ptrCast to cast from '[]u32'29// :6:20: note: use @ptrCast to cast from '[]u32'
test/cases/f32_passed_to_variadic_fn.zig+1-1
...@@ -7,7 +7,7 @@ pub fn main() void {...@@ -7,7 +7,7 @@ pub fn main() void {
7}7}
88
9// run9// run
10// backend=stage2,llvm10// backend=selfhosted,llvm
11// target=x86_64-linux-gnu11// target=x86_64-linux-gnu
12// link_libc=true12// link_libc=true
13//13//
test/cases/f_segment_address_space_reading_and_writing.zig created+49
...@@ -0,0 +1,49 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5fn setFs(value: c_ulong) void {
6 asm volatile (
7 \\syscall
8 :
9 : [number] "{rax}" (158),
10 [code] "{rdi}" (0x1002),
11 [val] "{rsi}" (value),
12 : .{ .rcx = true, .r11 = true, .memory = true }
13 );
14}
15
16fn getFs() c_ulong {
17 var result: c_ulong = undefined;
18 asm volatile (
19 \\syscall
20 :
21 : [number] "{rax}" (158),
22 [code] "{rdi}" (0x1003),
23 [ptr] "{rsi}" (@intFromPtr(&result)),
24 : .{ .rcx = true, .r11 = true, .memory = true }
25 );
26 return result;
27}
28
29var test_value: u64 = 12345;
30
31pub fn main() void {
32 const orig_fs = getFs();
33
34 setFs(@intFromPtr(&test_value));
35 assert(getFs() == @intFromPtr(&test_value));
36
37 var test_ptr: *allowzero addrspace(.fs) u64 = @ptrFromInt(0);
38 _ = &test_ptr;
39 assert(test_ptr.* == 12345);
40 test_ptr.* = 98765;
41 assert(test_value == 98765);
42
43 setFs(orig_fs);
44}
45
46// run
47// backend=llvm
48// target=x86_64-linux
49//
test/cases/float_mode_optimized_reduce.zig+1-1
...@@ -8,5 +8,5 @@ pub fn main() void {...@@ -8,5 +8,5 @@ pub fn main() void {
8}8}
99
10// run10// run
11// backend=stage2,llvm11// backend=selfhosted,llvm
12// target=x86_64-linux12// target=x86_64-linux
test/cases/fn_typeinfo_passed_to_comptime_fn.zig+1-1
...@@ -14,5 +14,5 @@ fn foo(comptime info: std.builtin.Type) !void {...@@ -14,5 +14,5 @@ fn foo(comptime info: std.builtin.Type) !void {
1414
15// run15// run
16// is_test=true16// is_test=true
17// backend=stage2,llvm17// backend=selfhosted,llvm
18//18//
test/cases/for_loop.zig created+16
...@@ -0,0 +1,16 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5pub fn main() void {
6 var x: u32 = 0;
7 for ("hello") |_| {
8 x += 1;
9 }
10 assert("hello".len == x);
11}
12
13// run
14// backend=selfhosted,llvm
15// target=x86_64-linux,x86_64-macos
16//
test/cases/hello_world.zig created+13
...@@ -0,0 +1,13 @@
1extern fn puts(s: [*:0]const u8) c_int;
2
3pub fn main() void {
4 _ = puts("hello world!");
5}
6
7// run
8// backend=selfhosted,llvm
9// target=x86_64-linux,x86_64-macos
10// link_libc=true
11//
12// hello world!
13//
test/cases/large_add_function.zig+1-1
...@@ -36,5 +36,5 @@ fn assert(ok: bool) void {...@@ -36,5 +36,5 @@ fn assert(ok: bool) void {
36// TODO: enable this for native backend36// TODO: enable this for native backend
3737
38// run38// run
39// backend=stage2,llvm39// backend=selfhosted,llvm
40// target=aarch64-linux,aarch64-macos40// target=aarch64-linux,aarch64-macos
test/cases/large_slices.zig created+9
...@@ -0,0 +1,9 @@
1pub fn main() void {
2 const large_slice = @as([*]const u8, @ptrFromInt(1))[0..(0xffffffffffffffff >> 3)];
3 _ = large_slice;
4}
5
6// compile
7// backend=selfhosted,llvm
8// target=x86_64-linux,x86_64-macos
9//
test/cases/llvm/address_space_pointer_access_chaining_pointer_to_optional_array.zig deleted-12
...@@ -1,12 +0,0 @@
1fn entry(a: *addrspace(.gs) ?[1]i32) *addrspace(.gs) i32 {
2 return &a.*.?[0];
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=stage2,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/llvm/address_spaces_pointer_access_chaining_array_pointer.zig deleted-12
...@@ -1,12 +0,0 @@
1fn entry(a: *addrspace(.gs) [1]i32) *addrspace(.gs) i32 {
2 return &a[0];
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=stage2,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/llvm/address_spaces_pointer_access_chaining_complex.zig deleted-13
...@@ -1,13 +0,0 @@
1const A = struct { a: ?[1]i32 };
2fn entry(a: *addrspace(.gs) [1]A) *addrspace(.gs) i32 {
3 return &a[0].a.?[0];
4}
5pub fn main() void {
6 _ = &entry;
7}
8
9// compile
10// output_mode=Exe
11// backend=stage2,llvm
12// target=x86_64-linux,x86_64-macos
13//
test/cases/llvm/address_spaces_pointer_access_chaining_struct_pointer.zig deleted-13
...@@ -1,13 +0,0 @@
1const A = struct { a: i32 };
2fn entry(a: *addrspace(.gs) A) *addrspace(.gs) i32 {
3 return &a.a;
4}
5pub fn main() void {
6 _ = &entry;
7}
8
9// compile
10// output_mode=Exe
11// backend=stage2,llvm
12// target=x86_64-linux,x86_64-macos
13//
test/cases/llvm/blocks.zig deleted-23
...@@ -1,23 +0,0 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5fn foo(ok: bool) i32 {
6 const val: i32 = blk: {
7 var x: i32 = 1;
8 _ = &x;
9 if (!ok) break :blk x + 9;
10 break :blk x + 19;
11 };
12 return val + 10;
13}
14
15pub fn main() void {
16 assert(foo(false) == 20);
17 assert(foo(true) == 30);
18}
19
20// run
21// backend=stage2,llvm
22// target=x86_64-linux,x86_64-macos
23//
test/cases/llvm/dereferencing_though_multiple_pointers_with_address_spaces.zig deleted-12
...@@ -1,12 +0,0 @@
1fn entry(a: *addrspace(.fs) *addrspace(.gs) *i32) *i32 {
2 return a.*.*;
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=stage2,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/llvm/f_segment_address_space_reading_and_writing.zig deleted-49
...@@ -1,49 +0,0 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5fn setFs(value: c_ulong) void {
6 asm volatile (
7 \\syscall
8 :
9 : [number] "{rax}" (158),
10 [code] "{rdi}" (0x1002),
11 [val] "{rsi}" (value),
12 : .{ .rcx = true, .r11 = true, .memory = true }
13 );
14}
15
16fn getFs() c_ulong {
17 var result: c_ulong = undefined;
18 asm volatile (
19 \\syscall
20 :
21 : [number] "{rax}" (158),
22 [code] "{rdi}" (0x1003),
23 [ptr] "{rsi}" (@intFromPtr(&result)),
24 : .{ .rcx = true, .r11 = true, .memory = true }
25 );
26 return result;
27}
28
29var test_value: u64 = 12345;
30
31pub fn main() void {
32 const orig_fs = getFs();
33
34 setFs(@intFromPtr(&test_value));
35 assert(getFs() == @intFromPtr(&test_value));
36
37 var test_ptr: *allowzero addrspace(.fs) u64 = @ptrFromInt(0);
38 _ = &test_ptr;
39 assert(test_ptr.* == 12345);
40 test_ptr.* = 98765;
41 assert(test_value == 98765);
42
43 setFs(orig_fs);
44}
45
46// run
47// backend=llvm
48// target=x86_64-linux
49//
test/cases/llvm/for_loop.zig deleted-16
...@@ -1,16 +0,0 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5pub fn main() void {
6 var x: u32 = 0;
7 for ("hello") |_| {
8 x += 1;
9 }
10 assert("hello".len == x);
11}
12
13// run
14// backend=stage2,llvm
15// target=x86_64-linux,x86_64-macos
16//
test/cases/llvm/hello_world.zig deleted-13
...@@ -1,13 +0,0 @@
1extern fn puts(s: [*:0]const u8) c_int;
2
3pub fn main() void {
4 _ = puts("hello world!");
5}
6
7// run
8// backend=stage2,llvm
9// target=x86_64-linux,x86_64-macos
10// link_libc=true
11//
12// hello world!
13//
test/cases/llvm/large_slices.zig deleted-9
...@@ -1,9 +0,0 @@
1pub fn main() void {
2 const large_slice = @as([*]const u8, @ptrFromInt(1))[0..(0xffffffffffffffff >> 3)];
3 _ = large_slice;
4}
5
6// compile
7// backend=stage2,llvm
8// target=x86_64-linux,x86_64-macos
9//
test/cases/llvm/nested_blocks.zig deleted-24
...@@ -1,24 +0,0 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5fn foo(ok: bool) i32 {
6 var val: i32 = blk: {
7 const val2: i32 = another: {
8 if (!ok) break :blk 10;
9 break :another 10;
10 };
11 break :blk val2 + 10;
12 };
13 return (&val).*;
14}
15
16pub fn main() void {
17 assert(foo(false) == 10);
18 assert(foo(true) == 20);
19}
20
21// run
22// backend=stage2,llvm
23// target=x86_64-linux,x86_64-macos
24//
test/cases/llvm/optionals.zig deleted-49
...@@ -1,49 +0,0 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5pub fn main() void {
6 var opt_val: ?i32 = 10;
7 var null_val: ?i32 = null;
8
9 var val1: i32 = opt_val.?;
10 _ = &val1;
11 const val1_1: i32 = opt_val.?;
12 var ptr_val1 = &(opt_val.?);
13 _ = &ptr_val1;
14 const ptr_val1_1 = &(opt_val.?);
15
16 var val2: i32 = null_val orelse 20;
17 const val2_2: i32 = null_val orelse 20;
18
19 var value: i32 = 20;
20 var ptr_val2 = &(null_val orelse value);
21 _ = &ptr_val2;
22
23 const val3 = opt_val orelse 30;
24 var val3_var = opt_val orelse 30;
25 _ = &val3_var;
26
27 assert(val1 == 10);
28 assert(val1_1 == 10);
29 assert(ptr_val1.* == 10);
30 assert(ptr_val1_1.* == 10);
31
32 assert(val2 == 20);
33 assert(val2_2 == 20);
34 assert(ptr_val2.* == 20);
35
36 assert(val3 == 10);
37 assert(val3_var == 10);
38
39 (null_val orelse val2) = 1234;
40 assert(val2 == 1234);
41
42 (opt_val orelse val2) = 5678;
43 assert(opt_val.? == 5678);
44}
45
46// run
47// backend=stage2,llvm
48// target=x86_64-linux,x86_64-macos
49//
test/cases/llvm/pointer_keeps_address_space.zig deleted-12
...@@ -1,12 +0,0 @@
1fn entry(a: *addrspace(.gs) i32) *addrspace(.gs) i32 {
2 return a;
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=stage2,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/llvm/pointer_keeps_address_space_when_taking_address_of_dereference.zig deleted-12
...@@ -1,12 +0,0 @@
1fn entry(a: *addrspace(.gs) i32) *addrspace(.gs) i32 {
2 return &a.*;
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=stage2,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/llvm/pointer_to_explicit_generic_address_space_coerces_to_implicit_pointer.zig deleted-12
...@@ -1,12 +0,0 @@
1fn entry(a: *addrspace(.generic) i32) *i32 {
2 return a;
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=stage2,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/llvm/rem.zig deleted-15
...@@ -1,15 +0,0 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4fn rem(lhs: i32, rhs: i32, expected: i32) bool {
5 return @rem(lhs, rhs) == expected;
6}
7pub fn main() void {
8 assert(rem(-5, 3, -2));
9 assert(rem(5, 3, 2));
10}
11
12// run
13// backend=stage2,llvm
14// target=x86_64-linux,x86_64-macos
15//
test/cases/llvm/simple_addition_and_subtraction.zig deleted-21
...@@ -1,21 +0,0 @@
1fn add(a: i32, b: i32) i32 {
2 return a + b;
3}
4
5pub fn main() void {
6 var a: i32 = -5;
7 _ = &a;
8 const x = add(a, 7);
9 var y = add(2, 0);
10 y -= x;
11 assert(y == 0);
12}
13
14fn assert(ok: bool) void {
15 if (!ok) unreachable;
16}
17
18// run
19// backend=stage2,llvm
20// target=x86_64-linux,x86_64-macos
21//
test/cases/llvm/simple_if_statement.zig deleted-16
...@@ -1,16 +0,0 @@
1fn add(a: i32, b: i32) i32 {
2 return a + b;
3}
4
5fn assert(ok: bool) void {
6 if (!ok) unreachable;
7}
8
9pub fn main() void {
10 assert(add(1, 2) == 3);
11}
12
13// run
14// backend=stage2,llvm
15// target=x86_64-linux,x86_64-macos
16//
test/cases/llvm/while_loops.zig deleted-18
...@@ -1,18 +0,0 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5pub fn main() void {
6 var sum: u32 = 0;
7 var i: u32 = 0;
8 while (i < 5) : (i += 1) {
9 sum += i;
10 }
11 assert(sum == 10);
12 assert(i == 5);
13}
14
15// run
16// backend=stage2,llvm
17// target=x86_64-linux,x86_64-macos
18//
test/cases/maximum_sized_integer_literal.zig+1-2
...@@ -18,5 +18,4 @@ pub fn main() !void {...@@ -18,5 +18,4 @@ pub fn main() !void {
18}18}
1919
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=native
test/cases/nested_blocks.zig created+24
...@@ -0,0 +1,24 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5fn foo(ok: bool) i32 {
6 var val: i32 = blk: {
7 const val2: i32 = another: {
8 if (!ok) break :blk 10;
9 break :another 10;
10 };
11 break :blk val2 + 10;
12 };
13 return (&val).*;
14}
15
16pub fn main() void {
17 assert(foo(false) == 10);
18 assert(foo(true) == 20);
19}
20
21// run
22// backend=selfhosted,llvm
23// target=x86_64-linux,x86_64-macos
24//
test/cases/optionals.zig created+49
...@@ -0,0 +1,49 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5pub fn main() void {
6 var opt_val: ?i32 = 10;
7 var null_val: ?i32 = null;
8
9 var val1: i32 = opt_val.?;
10 _ = &val1;
11 const val1_1: i32 = opt_val.?;
12 var ptr_val1 = &(opt_val.?);
13 _ = &ptr_val1;
14 const ptr_val1_1 = &(opt_val.?);
15
16 var val2: i32 = null_val orelse 20;
17 const val2_2: i32 = null_val orelse 20;
18
19 var value: i32 = 20;
20 var ptr_val2 = &(null_val orelse value);
21 _ = &ptr_val2;
22
23 const val3 = opt_val orelse 30;
24 var val3_var = opt_val orelse 30;
25 _ = &val3_var;
26
27 assert(val1 == 10);
28 assert(val1_1 == 10);
29 assert(ptr_val1.* == 10);
30 assert(ptr_val1_1.* == 10);
31
32 assert(val2 == 20);
33 assert(val2_2 == 20);
34 assert(ptr_val2.* == 20);
35
36 assert(val3 == 10);
37 assert(val3_var == 10);
38
39 (null_val orelse val2) = 1234;
40 assert(val2 == 1234);
41
42 (opt_val orelse val2) = 5678;
43 assert(opt_val.? == 5678);
44}
45
46// run
47// backend=selfhosted,llvm
48// target=x86_64-linux,x86_64-macos
49//
test/cases/pic_freestanding.zig+1-1
...@@ -8,7 +8,7 @@ comptime {...@@ -8,7 +8,7 @@ comptime {
8}8}
99
10// compile10// compile
11// backend=stage2,llvm11// backend=selfhosted,llvm
12// target=arm-freestanding,armeb-freestanding,thumb-freestanding,thumbeb-freestanding,aarch64-freestanding,aarch64_be-freestanding,loongarch64-freestanding,mips-freestanding,mipsel-freestanding,mips64-freestanding,mips64el-freestanding,powerpc-freestanding,powerpcle-freestanding,powerpc64-freestanding,powerpc64le-freestanding,riscv32-freestanding,riscv64-freestanding,s390x-freestanding,x86-freestanding,x86_64-freestanding12// target=arm-freestanding,armeb-freestanding,thumb-freestanding,thumbeb-freestanding,aarch64-freestanding,aarch64_be-freestanding,loongarch64-freestanding,mips-freestanding,mipsel-freestanding,mips64-freestanding,mips64el-freestanding,powerpc-freestanding,powerpcle-freestanding,powerpc64-freestanding,powerpc64le-freestanding,riscv32-freestanding,riscv64-freestanding,s390x-freestanding,x86-freestanding,x86_64-freestanding
13// pic=true13// pic=true
14// output_mode=Exe14// output_mode=Exe
test/cases/pic_linux.zig+1-1
...@@ -8,7 +8,7 @@ const std = @import("std");...@@ -8,7 +8,7 @@ const std = @import("std");
8pub fn main() void {}8pub fn main() void {}
99
10// run10// run
11// backend=stage2,llvm11// backend=selfhosted,llvm
12// target=arm-linux,armeb-linux,thumb-linux,thumbeb-linux,aarch64-linux,aarch64_be-linux,loongarch64-linux,mips-linux,mipsel-linux,mips64-linux,mips64el-linux,powerpc-linux,powerpc64-linux,powerpc64le-linux,riscv32-linux,riscv64-linux,s390x-linux,x86-linux,x86_64-linux12// target=arm-linux,armeb-linux,thumb-linux,thumbeb-linux,aarch64-linux,aarch64_be-linux,loongarch64-linux,mips-linux,mipsel-linux,mips64-linux,mips64el-linux,powerpc-linux,powerpc64-linux,powerpc64le-linux,riscv32-linux,riscv64-linux,s390x-linux,x86-linux,x86_64-linux
13// pic=true13// pic=true
14// link_libc=true14// link_libc=true
test/cases/pointer_keeps_address_space.zig created+12
...@@ -0,0 +1,12 @@
1fn entry(a: *addrspace(.gs) i32) *addrspace(.gs) i32 {
2 return a;
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=selfhosted,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/pointer_keeps_address_space_when_taking_address_of_dereference.zig created+12
...@@ -0,0 +1,12 @@
1fn entry(a: *addrspace(.gs) i32) *addrspace(.gs) i32 {
2 return &a.*;
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=selfhosted,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/pointer_to_explicit_generic_address_space_coerces_to_implicit_pointer.zig created+12
...@@ -0,0 +1,12 @@
1fn entry(a: *addrspace(.generic) i32) *i32 {
2 return a;
3}
4pub fn main() void {
5 _ = &entry;
6}
7
8// compile
9// output_mode=Exe
10// backend=selfhosted,llvm
11// target=x86_64-linux,x86_64-macos
12//
test/cases/rem.zig created+15
...@@ -0,0 +1,15 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4fn rem(lhs: i32, rhs: i32, expected: i32) bool {
5 return @rem(lhs, rhs) == expected;
6}
7pub fn main() void {
8 assert(rem(-5, 3, -2));
9 assert(rem(5, 3, 2));
10}
11
12// run
13// backend=selfhosted,llvm
14// target=x86_64-linux,x86_64-macos
15//
test/cases/returning_undefined_sentinel_terminated_const_u8_slice.zig+1-2
...@@ -7,5 +7,4 @@ pub fn main() void {...@@ -7,5 +7,4 @@ pub fn main() void {
7}7}
88
9// run9// run
10// backend=stage2,llvm10// backend=selfhosted,llvm
11// target=native
test/cases/safety/@alignCast misaligned.zig +1-1
...@@ -21,5 +21,5 @@ fn foo(bytes: []u8) u32 {...@@ -21,5 +21,5 @@ fn foo(bytes: []u8) u32 {
21 return int_slice[0];21 return int_slice[0];
22}22}
23// run23// run
24// backend=stage2,llvm24// backend=selfhosted,llvm
25// target=x86_64-linux,aarch64-linux25// target=x86_64-linux,aarch64-linux
test/cases/safety/@enumFromInt - no matching tag value.zig +1-1
...@@ -22,5 +22,5 @@ fn bar(a: u2) Foo {...@@ -22,5 +22,5 @@ fn bar(a: u2) Foo {
22fn baz(_: Foo) void {}22fn baz(_: Foo) void {}
2323
24// run24// run
25// backend=stage2,llvm25// backend=selfhosted,llvm
26// target=x86_64-linux26// target=x86_64-linux
test/cases/safety/@enumFromInt truncated bits - exhaustive.zig +1-1
...@@ -19,5 +19,5 @@ pub fn main() u8 {...@@ -19,5 +19,5 @@ pub fn main() u8 {
19}19}
2020
21// run21// run
22// backend=stage2,llvm22// backend=selfhosted,llvm
23// target=x86_64-linux23// target=x86_64-linux
test/cases/safety/@enumFromInt truncated bits - nonexhaustive.zig +1-1
...@@ -19,5 +19,5 @@ pub fn main() u8 {...@@ -19,5 +19,5 @@ pub fn main() u8 {
19}19}
2020
21// run21// run
22// backend=stage2,llvm22// backend=selfhosted,llvm
23// target=x86_64-linux23// target=x86_64-linux
test/cases/safety/@errorCast error not present in destination.zig +1-1
...@@ -17,5 +17,5 @@ fn foo(set1: Set1) Set2 {...@@ -17,5 +17,5 @@ fn foo(set1: Set1) Set2 {
17 return @errorCast(set1);17 return @errorCast(set1);
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux21// target=x86_64-linux
test/cases/safety/@errorCast error union casted to disjoint set.zig +1-1
...@@ -16,5 +16,5 @@ fn foo() anyerror!i32 {...@@ -16,5 +16,5 @@ fn foo() anyerror!i32 {
16 return error.Bar;16 return error.Bar;
17}17}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux20// target=x86_64-linux
test/cases/safety/@intCast to u0.zig +1-1
...@@ -18,5 +18,5 @@ fn bar(one: u1, not_zero: i32) void {...@@ -18,5 +18,5 @@ fn bar(one: u1, not_zero: i32) void {
18 _ = x;18 _ = x;
19}19}
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=x86_64-linux,aarch64-linux22// target=x86_64-linux,aarch64-linux
test/cases/safety/@intFromFloat cannot fit - boundary case - i0 max.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux,aarch64-linux16// target=x86_64-linux,aarch64-linux
test/cases/safety/@intFromFloat cannot fit - boundary case - i0 min.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux,aarch64-linux16// target=x86_64-linux,aarch64-linux
test/cases/safety/@intFromFloat cannot fit - boundary case - signed max.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux16// target=x86_64-linux
test/cases/safety/@intFromFloat cannot fit - boundary case - signed min.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux16// target=x86_64-linux
test/cases/safety/@intFromFloat cannot fit - boundary case - u0 max.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux,aarch64-linux16// target=x86_64-linux,aarch64-linux
test/cases/safety/@intFromFloat cannot fit - boundary case - u0 min.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux,aarch64-linux16// target=x86_64-linux,aarch64-linux
test/cases/safety/@intFromFloat cannot fit - boundary case - unsigned max.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux16// target=x86_64-linux
test/cases/safety/@intFromFloat cannot fit - boundary case - unsigned min.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux16// target=x86_64-linux
test/cases/safety/@intFromFloat cannot fit - boundary case - vector max.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux16// target=x86_64-linux
test/cases/safety/@intFromFloat cannot fit - boundary case - vector min.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux16// target=x86_64-linux
test/cases/safety/@intFromFloat cannot fit - negative out of range.zig +1-1
...@@ -16,5 +16,5 @@ fn bar(a: f32) i8 {...@@ -16,5 +16,5 @@ fn bar(a: f32) i8 {
16}16}
17fn baz(_: i8) void {}17fn baz(_: i8) void {}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux20// target=x86_64-linux
test/cases/safety/@intFromFloat cannot fit - negative to unsigned.zig +1-1
...@@ -16,5 +16,5 @@ fn bar(a: f32) u8 {...@@ -16,5 +16,5 @@ fn bar(a: f32) u8 {
16}16}
17fn baz(_: u8) void {}17fn baz(_: u8) void {}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux20// target=x86_64-linux
test/cases/safety/@intFromFloat cannot fit - positive out of range.zig +1-1
...@@ -16,5 +16,5 @@ fn bar(a: f32) u8 {...@@ -16,5 +16,5 @@ fn bar(a: f32) u8 {
16}16}
17fn baz(_: u8) void {}17fn baz(_: u8) void {}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux20// target=x86_64-linux
test/cases/safety/@ptrFromInt address zero to non-optional byte-aligned pointer.zig +1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/@ptrFromInt address zero to non-optional pointer.zig +1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/@ptrFromInt with misaligned address.zig +1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/@tagName on corrupted enum value.zig +1-1
...@@ -22,5 +22,5 @@ pub fn main() !void {...@@ -22,5 +22,5 @@ pub fn main() !void {
22}22}
2323
24// run24// run
25// backend=stage2,llvm25// backend=selfhosted,llvm
26// target=x86_64-linux26// target=x86_64-linux
test/cases/safety/@tagName on corrupted union value.zig +1-1
...@@ -23,5 +23,5 @@ pub fn main() !void {...@@ -23,5 +23,5 @@ pub fn main() !void {
23}23}
2424
25// run25// run
26// backend=stage2,llvm26// backend=selfhosted,llvm
27// target=x86_64-linux27// target=x86_64-linux
test/cases/safety/array slice sentinel mismatch vector.zig +1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux19// target=x86_64-linux
test/cases/safety/array slice sentinel mismatch.zig +1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/bad union field access.zig +1-1
...@@ -23,5 +23,5 @@ fn bar(f: *Foo) void {...@@ -23,5 +23,5 @@ fn bar(f: *Foo) void {
23 f.float = 12.34;23 f.float = 12.34;
24}24}
25// run25// run
26// backend=stage2,llvm26// backend=selfhosted,llvm
27// target=x86_64-linux27// target=x86_64-linux
test/cases/safety/calling panic.zig +1-1
...@@ -12,5 +12,5 @@ pub fn main() !void {...@@ -12,5 +12,5 @@ pub fn main() !void {
12 return error.TestFailed;12 return error.TestFailed;
13}13}
14// run14// run
15// backend=stage2,llvm15// backend=selfhosted,llvm
16// target=x86_64-linux,aarch64-linux16// target=x86_64-linux,aarch64-linux
test/cases/safety/cast []u8 to bigger slice of wrong size.zig +1-1
...@@ -17,5 +17,5 @@ fn widenSlice(slice: []align(1) const u8) []align(1) const i32 {...@@ -17,5 +17,5 @@ fn widenSlice(slice: []align(1) const u8) []align(1) const i32 {
17 return std.mem.bytesAsSlice(i32, slice);17 return std.mem.bytesAsSlice(i32, slice);
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/cast integer to global error and no code matches.zig +1-1
...@@ -15,5 +15,5 @@ fn bar(x: u16) anyerror {...@@ -15,5 +15,5 @@ fn bar(x: u16) anyerror {
15 return @errorFromInt(x);15 return @errorFromInt(x);
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/empty slice with sentinel out of bounds.zig +1-1
...@@ -17,5 +17,5 @@ pub fn main() !void {...@@ -17,5 +17,5 @@ pub fn main() !void {
17}17}
1818
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/exact division failure - vectors.zig +1-1
...@@ -19,5 +19,5 @@ fn divExact(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {...@@ -19,5 +19,5 @@ fn divExact(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {
19 return @divExact(a, b);19 return @divExact(a, b);
20}20}
21// run21// run
22// backend=stage2,llvm22// backend=selfhosted,llvm
23// target=x86_64-linux23// target=x86_64-linux
test/cases/safety/exact division failure.zig +1-1
...@@ -17,5 +17,5 @@ fn divExact(a: i32, b: i32) i32 {...@@ -17,5 +17,5 @@ fn divExact(a: i32, b: i32) i32 {
17 return @divExact(a, b);17 return @divExact(a, b);
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/for_len_mismatch.zig+1-1
...@@ -21,5 +21,5 @@ pub fn main() !void {...@@ -21,5 +21,5 @@ pub fn main() !void {
21 return error.TestFailed;21 return error.TestFailed;
22}22}
23// run23// run
24// backend=stage2,llvm24// backend=selfhosted,llvm
25// target=x86_64-linux,aarch64-linux25// target=x86_64-linux,aarch64-linux
test/cases/safety/for_len_mismatch_three.zig+1-1
...@@ -20,5 +20,5 @@ pub fn main() !void {...@@ -20,5 +20,5 @@ pub fn main() !void {
20 return error.TestFailed;20 return error.TestFailed;
21}21}
22// run22// run
23// backend=stage2,llvm23// backend=selfhosted,llvm
24// target=x86_64-linux,aarch64-linux24// target=x86_64-linux,aarch64-linux
test/cases/safety/ignored expression integer overflow.zig +1-1
...@@ -17,5 +17,5 @@ pub fn main() !void {...@@ -17,5 +17,5 @@ pub fn main() !void {
17}17}
1818
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux21// target=x86_64-linux
test/cases/safety/integer addition overflow.zig +1-1
...@@ -19,5 +19,5 @@ fn add(a: u16, b: u16) u16 {...@@ -19,5 +19,5 @@ fn add(a: u16, b: u16) u16 {
19}19}
2020
21// run21// run
22// backend=stage2,llvm22// backend=selfhosted,llvm
23// target=x86_64-linux,aarch64-linux23// target=x86_64-linux,aarch64-linux
test/cases/safety/integer division by zero - vectors.zig +1-1
...@@ -18,5 +18,5 @@ fn div0(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {...@@ -18,5 +18,5 @@ fn div0(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {
18 return @divTrunc(a, b);18 return @divTrunc(a, b);
19}19}
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=x86_64-linux22// target=x86_64-linux
test/cases/safety/integer division by zero.zig +1-1
...@@ -16,5 +16,5 @@ fn div0(a: i32, b: i32) i32 {...@@ -16,5 +16,5 @@ fn div0(a: i32, b: i32) i32 {
16 return @divTrunc(a, b);16 return @divTrunc(a, b);
17}17}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux,aarch64-linux20// target=x86_64-linux,aarch64-linux
test/cases/safety/integer multiplication overflow.zig +1-1
...@@ -17,5 +17,5 @@ fn mul(a: u16, b: u16) u16 {...@@ -17,5 +17,5 @@ fn mul(a: u16, b: u16) u16 {
17 return a * b;17 return a * b;
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/integer negation overflow.zig +1-1
...@@ -17,5 +17,5 @@ fn neg(a: i16) i16 {...@@ -17,5 +17,5 @@ fn neg(a: i16) i16 {
17 return -a;17 return -a;
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/integer subtraction overflow.zig +1-1
...@@ -17,5 +17,5 @@ fn sub(a: u16, b: u16) u16 {...@@ -17,5 +17,5 @@ fn sub(a: u16, b: u16) u16 {
17 return a - b;17 return a - b;
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/memcpy_alias.zig+1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/memcpy_len_mismatch.zig+1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/memmove_len_mismatch.zig+1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/memset_array_undefined_bytes.zig+1-1
...@@ -14,5 +14,5 @@ pub fn main() !void {...@@ -14,5 +14,5 @@ pub fn main() !void {
14 x += buffer[2];14 x += buffer[2];
15}15}
16// run16// run
17// backend=stage2,llvm17// backend=selfhosted,llvm
18// target=x86_64-linux,aarch64-linux18// target=x86_64-linux,aarch64-linux
test/cases/safety/memset_array_undefined_large.zig+1-1
...@@ -14,5 +14,5 @@ pub fn main() !void {...@@ -14,5 +14,5 @@ pub fn main() !void {
14 x += buffer[2];14 x += buffer[2];
15}15}
16// run16// run
17// backend=stage2,llvm17// backend=selfhosted,llvm
18// target=x86_64-linux,aarch64-linux18// target=x86_64-linux,aarch64-linux
test/cases/safety/memset_slice_undefined_bytes.zig+1-1
...@@ -16,5 +16,5 @@ pub fn main() !void {...@@ -16,5 +16,5 @@ pub fn main() !void {
16 x += buffer[2];16 x += buffer[2];
17}17}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux,aarch64-linux20// target=x86_64-linux,aarch64-linux
test/cases/safety/memset_slice_undefined_large.zig+1-1
...@@ -16,5 +16,5 @@ pub fn main() !void {...@@ -16,5 +16,5 @@ pub fn main() !void {
16 x += buffer[2];16 x += buffer[2];
17}17}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux,aarch64-linux20// target=x86_64-linux,aarch64-linux
test/cases/safety/modrem by zero.zig +1-1
...@@ -16,5 +16,5 @@ fn div0(a: u32, b: u32) u32 {...@@ -16,5 +16,5 @@ fn div0(a: u32, b: u32) u32 {
16 return a / b;16 return a / b;
17}17}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux,aarch64-linux20// target=x86_64-linux,aarch64-linux
test/cases/safety/modulus by zero.zig +1-1
...@@ -16,5 +16,5 @@ fn mod0(a: i32, b: i32) i32 {...@@ -16,5 +16,5 @@ fn mod0(a: i32, b: i32) i32 {
16 return @mod(a, b);16 return @mod(a, b);
17}17}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux20// target=x86_64-linux
test/cases/safety/noreturn returned.zig +1-1
...@@ -19,5 +19,5 @@ pub fn main() void {...@@ -19,5 +19,5 @@ pub fn main() void {
19 bar();19 bar();
20}20}
21// run21// run
22// backend=stage2,llvm22// backend=selfhosted,llvm
23// target=x86_64-linux,aarch64-linux23// target=x86_64-linux,aarch64-linux
test/cases/safety/optional unwrap operator on C pointer.zig +1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/optional unwrap operator on null pointer.zig +1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/optional_empty_error_set.zig+1-1
...@@ -18,5 +18,5 @@ fn foo() !void {...@@ -18,5 +18,5 @@ fn foo() !void {
18 return x.?;18 return x.?;
19}19}
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=x86_64-linux,aarch64-linux22// target=x86_64-linux,aarch64-linux
test/cases/safety/out of bounds array slice by length.zig +1-1
...@@ -16,5 +16,5 @@ fn foo(a: u32) u32 {...@@ -16,5 +16,5 @@ fn foo(a: u32) u32 {
16 return a;16 return a;
17}17}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux,aarch64-linux20// target=x86_64-linux,aarch64-linux
test/cases/safety/out of bounds slice access.zig +1-1
...@@ -17,5 +17,5 @@ fn bar(a: []const i32) i32 {...@@ -17,5 +17,5 @@ fn bar(a: []const i32) i32 {
17}17}
18fn baz(_: i32) void {}18fn baz(_: i32) void {}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/pointer casting null to non-optional pointer.zig +1-1
...@@ -17,5 +17,5 @@ pub fn main() !void {...@@ -17,5 +17,5 @@ pub fn main() !void {
17}17}
1818
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/pointer casting to null function pointer.zig +1-1
...@@ -19,5 +19,5 @@ pub fn main() !void {...@@ -19,5 +19,5 @@ pub fn main() !void {
19}19}
2020
21// run21// run
22// backend=stage2,llvm22// backend=selfhosted,llvm
23// target=x86_64-linux,aarch64-linux23// target=x86_64-linux,aarch64-linux
test/cases/safety/pointer slice sentinel mismatch.zig +1-1
...@@ -17,5 +17,5 @@ pub fn main() !void {...@@ -17,5 +17,5 @@ pub fn main() !void {
17}17}
1818
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/remainder division by zero.zig +1-1
...@@ -16,5 +16,5 @@ fn rem0(a: i32, b: i32) i32 {...@@ -16,5 +16,5 @@ fn rem0(a: i32, b: i32) i32 {
16 return @rem(a, b);16 return @rem(a, b);
17}17}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux,aarch64-linux20// target=x86_64-linux,aarch64-linux
test/cases/safety/shift left by huge amount.zig +1-1
...@@ -18,5 +18,5 @@ pub fn main() !void {...@@ -18,5 +18,5 @@ pub fn main() !void {
18}18}
1919
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=x86_64-linux,aarch64-linux22// target=x86_64-linux,aarch64-linux
test/cases/safety/shift right by huge amount.zig +1-1
...@@ -18,5 +18,5 @@ pub fn main() !void {...@@ -18,5 +18,5 @@ pub fn main() !void {
18}18}
1919
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=x86_64-linux,aarch64-linux22// target=x86_64-linux,aarch64-linux
test/cases/safety/signed integer division overflow - vectors.zig +1-1
...@@ -19,5 +19,5 @@ fn div(a: @Vector(4, i16), b: @Vector(4, i16)) @Vector(4, i16) {...@@ -19,5 +19,5 @@ fn div(a: @Vector(4, i16), b: @Vector(4, i16)) @Vector(4, i16) {
19 return @divTrunc(a, b);19 return @divTrunc(a, b);
20}20}
21// run21// run
22// backend=stage2,llvm22// backend=selfhosted,llvm
23// target=x86_64-linux23// target=x86_64-linux
test/cases/safety/signed integer division overflow.zig +1-1
...@@ -17,5 +17,5 @@ fn div(a: i16, b: i16) i16 {...@@ -17,5 +17,5 @@ fn div(a: i16, b: i16) i16 {
17 return @divTrunc(a, b);17 return @divTrunc(a, b);
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/signed integer not fitting in cast to unsigned integer - widening.zig +1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux19// target=x86_64-linux
test/cases/safety/signed integer not fitting in cast to unsigned integer.zig +1-1
...@@ -16,5 +16,5 @@ fn unsigned_cast(x: i32) u32 {...@@ -16,5 +16,5 @@ fn unsigned_cast(x: i32) u32 {
16 return @intCast(x);16 return @intCast(x);
17}17}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux,aarch64-linux20// target=x86_64-linux,aarch64-linux
test/cases/safety/signed shift left overflow.zig +1-1
...@@ -17,5 +17,5 @@ fn shl(a: i16, b: u4) i16 {...@@ -17,5 +17,5 @@ fn shl(a: i16, b: u4) i16 {
17 return @shlExact(a, b);17 return @shlExact(a, b);
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux21// target=x86_64-linux
test/cases/safety/signed shift right overflow.zig +1-1
...@@ -17,5 +17,5 @@ fn shr(a: i16, b: u4) i16 {...@@ -17,5 +17,5 @@ fn shr(a: i16, b: u4) i16 {
17 return @shrExact(a, b);17 return @shrExact(a, b);
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/signed-unsigned vector cast.zig +1-1
...@@ -17,5 +17,5 @@ pub fn main() !void {...@@ -17,5 +17,5 @@ pub fn main() !void {
17}17}
1818
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux21// target=x86_64-linux
test/cases/safety/slice by length sentinel mismatch on lhs.zig +1-1
...@@ -14,5 +14,5 @@ pub fn main() !void {...@@ -14,5 +14,5 @@ pub fn main() !void {
14 return error.TestFailed;14 return error.TestFailed;
15}15}
16// run16// run
17// backend=stage2,llvm17// backend=selfhosted,llvm
18// target=x86_64-linux,aarch64-linux18// target=x86_64-linux,aarch64-linux
test/cases/safety/slice by length sentinel mismatch on rhs.zig +1-1
...@@ -14,5 +14,5 @@ pub fn main() !void {...@@ -14,5 +14,5 @@ pub fn main() !void {
14 return error.TestFailed;14 return error.TestFailed;
15}15}
16// run16// run
17// backend=stage2,llvm17// backend=selfhosted,llvm
18// target=x86_64-linux,aarch64-linux18// target=x86_64-linux,aarch64-linux
test/cases/safety/slice sentinel mismatch - floats.zig +1-1
...@@ -16,5 +16,5 @@ pub fn main() !void {...@@ -16,5 +16,5 @@ pub fn main() !void {
16}16}
1717
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux20// target=x86_64-linux
test/cases/safety/slice sentinel mismatch - optional pointers.zig +1-1
...@@ -16,5 +16,5 @@ pub fn main() !void {...@@ -16,5 +16,5 @@ pub fn main() !void {
16}16}
1717
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux,aarch64-linux20// target=x86_64-linux,aarch64-linux
test/cases/safety/slice slice sentinel mismatch.zig +1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/slice start index greater than end index.zig +1-1
...@@ -20,5 +20,5 @@ pub fn main() !void {...@@ -20,5 +20,5 @@ pub fn main() !void {
20}20}
2121
22// run22// run
23// backend=stage2,llvm23// backend=selfhosted,llvm
24// target=x86_64-linux,aarch64-linux24// target=x86_64-linux,aarch64-linux
test/cases/safety/slice with sentinel out of bounds - runtime len.zig +1-1
...@@ -19,5 +19,5 @@ pub fn main() !void {...@@ -19,5 +19,5 @@ pub fn main() !void {
19}19}
2020
21// run21// run
22// backend=stage2,llvm22// backend=selfhosted,llvm
23// target=x86_64-linux,aarch64-linux23// target=x86_64-linux,aarch64-linux
test/cases/safety/slice with sentinel out of bounds.zig +1-1
...@@ -17,5 +17,5 @@ pub fn main() !void {...@@ -17,5 +17,5 @@ pub fn main() !void {
17}17}
1818
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/slice_cast_change_len_0.zig+1-1
...@@ -23,5 +23,5 @@ pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noretu...@@ -23,5 +23,5 @@ pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noretu
23const std = @import("std");23const std = @import("std");
2424
25// run25// run
26// backend=stage2,llvm26// backend=selfhosted,llvm
27// target=x86_64-linux,aarch64-linux27// target=x86_64-linux,aarch64-linux
test/cases/safety/slice_cast_change_len_1.zig+1-1
...@@ -23,5 +23,5 @@ pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noretu...@@ -23,5 +23,5 @@ pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noretu
23const std = @import("std");23const std = @import("std");
2424
25// run25// run
26// backend=stage2,llvm26// backend=selfhosted,llvm
27// target=x86_64-linux,aarch64-linux27// target=x86_64-linux,aarch64-linux
test/cases/safety/slice_cast_change_len_2.zig+1-1
...@@ -23,5 +23,5 @@ pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noretu...@@ -23,5 +23,5 @@ pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noretu
23const std = @import("std");23const std = @import("std");
2424
25// run25// run
26// backend=stage2,llvm26// backend=selfhosted,llvm
27// target=x86_64-linux,aarch64-linux27// target=x86_64-linux,aarch64-linux
test/cases/safety/slicing null C pointer - runtime len.zig +1-1
...@@ -17,5 +17,5 @@ pub fn main() !void {...@@ -17,5 +17,5 @@ pub fn main() !void {
17 return error.TestFailed;17 return error.TestFailed;
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/slicing null C pointer.zig +1-1
...@@ -16,5 +16,5 @@ pub fn main() !void {...@@ -16,5 +16,5 @@ pub fn main() !void {
16 return error.TestFailed;16 return error.TestFailed;
17}17}
18// run18// run
19// backend=stage2,llvm19// backend=selfhosted,llvm
20// target=x86_64-linux,aarch64-linux20// target=x86_64-linux,aarch64-linux
test/cases/safety/switch else on corrupt enum value - one prong.zig +1-1
...@@ -20,5 +20,5 @@ pub fn main() !void {...@@ -20,5 +20,5 @@ pub fn main() !void {
20 }20 }
21}21}
22// run22// run
23// backend=stage2,llvm23// backend=selfhosted,llvm
24// target=x86_64-linux24// target=x86_64-linux
test/cases/safety/switch else on corrupt enum value - union.zig +1-1
...@@ -25,5 +25,5 @@ pub fn main() !void {...@@ -25,5 +25,5 @@ pub fn main() !void {
25 }25 }
26}26}
27// run27// run
28// backend=stage2,llvm28// backend=selfhosted,llvm
29// target=x86_64-linux29// target=x86_64-linux
test/cases/safety/switch else on corrupt enum value.zig +1-1
...@@ -19,5 +19,5 @@ pub fn main() !void {...@@ -19,5 +19,5 @@ pub fn main() !void {
19 }19 }
20}20}
21// run21// run
22// backend=stage2,llvm22// backend=selfhosted,llvm
23// target=x86_64-linux23// target=x86_64-linux
test/cases/safety/switch on corrupted enum value.zig +1-1
...@@ -23,5 +23,5 @@ pub fn main() !void {...@@ -23,5 +23,5 @@ pub fn main() !void {
23}23}
2424
25// run25// run
26// backend=stage2,llvm26// backend=selfhosted,llvm
27// target=x86_64-linux,aarch64-linux27// target=x86_64-linux,aarch64-linux
test/cases/safety/switch on corrupted union value.zig +1-1
...@@ -23,5 +23,5 @@ pub fn main() !void {...@@ -23,5 +23,5 @@ pub fn main() !void {
23}23}
2424
25// run25// run
26// backend=stage2,llvm26// backend=selfhosted,llvm
27// target=x86_64-linux27// target=x86_64-linux
test/cases/safety/truncating vector cast.zig +1-1
...@@ -17,5 +17,5 @@ pub fn main() !void {...@@ -17,5 +17,5 @@ pub fn main() !void {
17}17}
1818
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux21// target=x86_64-linux
test/cases/safety/unreachable.zig+1-1
...@@ -11,5 +11,5 @@ pub fn main() !void {...@@ -11,5 +11,5 @@ pub fn main() !void {
11 unreachable;11 unreachable;
12}12}
13// run13// run
14// backend=stage2,llvm14// backend=selfhosted,llvm
15// target=x86_64-linux,aarch64-linux15// target=x86_64-linux,aarch64-linux
test/cases/safety/unsigned integer not fitting in cast to signed integer - same bit count.zig +1-1
...@@ -15,5 +15,5 @@ pub fn main() !void {...@@ -15,5 +15,5 @@ pub fn main() !void {
15 return error.TestFailed;15 return error.TestFailed;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux19// target=x86_64-linux
test/cases/safety/unsigned shift left overflow.zig +1-1
...@@ -17,5 +17,5 @@ fn shl(a: u16, b: u4) u16 {...@@ -17,5 +17,5 @@ fn shl(a: u16, b: u4) u16 {
17 return @shlExact(a, b);17 return @shlExact(a, b);
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux21// target=x86_64-linux
test/cases/safety/unsigned shift right overflow.zig +1-1
...@@ -17,5 +17,5 @@ fn shr(a: u16, b: u4) u16 {...@@ -17,5 +17,5 @@ fn shr(a: u16, b: u4) u16 {
17 return @shrExact(a, b);17 return @shrExact(a, b);
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/unsigned-signed vector cast.zig +1-1
...@@ -17,5 +17,5 @@ pub fn main() !void {...@@ -17,5 +17,5 @@ pub fn main() !void {
17}17}
1818
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux21// target=x86_64-linux
test/cases/safety/unwrap error switch.zig +1-1
...@@ -17,5 +17,5 @@ fn bar() !void {...@@ -17,5 +17,5 @@ fn bar() !void {
17 return error.Whatever;17 return error.Whatever;
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/unwrap error.zig +1-1
...@@ -15,5 +15,5 @@ fn bar() !void {...@@ -15,5 +15,5 @@ fn bar() !void {
15 return error.Whatever;15 return error.Whatever;
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/safety/value does not fit in shortening cast - u0.zig +1-1
...@@ -17,5 +17,5 @@ fn shorten_cast(x: u8) u0 {...@@ -17,5 +17,5 @@ fn shorten_cast(x: u8) u0 {
17 return @intCast(x);17 return @intCast(x);
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/value does not fit in shortening cast.zig +1-1
...@@ -17,5 +17,5 @@ fn shorten_cast(x: i32) i8 {...@@ -17,5 +17,5 @@ fn shorten_cast(x: i32) i8 {
17 return @intCast(x);17 return @intCast(x);
18}18}
19// run19// run
20// backend=stage2,llvm20// backend=selfhosted,llvm
21// target=x86_64-linux,aarch64-linux21// target=x86_64-linux,aarch64-linux
test/cases/safety/vector integer addition overflow.zig +1-1
...@@ -18,5 +18,5 @@ fn add(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {...@@ -18,5 +18,5 @@ fn add(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {
18 return a + b;18 return a + b;
19}19}
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=x86_64-linux22// target=x86_64-linux
test/cases/safety/vector integer multiplication overflow.zig +1-1
...@@ -18,5 +18,5 @@ fn mul(a: @Vector(4, u8), b: @Vector(4, u8)) @Vector(4, u8) {...@@ -18,5 +18,5 @@ fn mul(a: @Vector(4, u8), b: @Vector(4, u8)) @Vector(4, u8) {
18 return a * b;18 return a * b;
19}19}
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=x86_64-linux22// target=x86_64-linux
test/cases/safety/vector integer negation overflow.zig +1-1
...@@ -18,5 +18,5 @@ fn neg(a: @Vector(4, i16)) @Vector(4, i16) {...@@ -18,5 +18,5 @@ fn neg(a: @Vector(4, i16)) @Vector(4, i16) {
18 return -a;18 return -a;
19}19}
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=x86_64-linux22// target=x86_64-linux
test/cases/safety/vector integer subtraction overflow.zig +1-1
...@@ -18,5 +18,5 @@ fn sub(a: @Vector(4, u32), b: @Vector(4, u32)) @Vector(4, u32) {...@@ -18,5 +18,5 @@ fn sub(a: @Vector(4, u32), b: @Vector(4, u32)) @Vector(4, u32) {
18 return a - b;18 return a - b;
19}19}
20// run20// run
21// backend=stage2,llvm21// backend=selfhosted,llvm
22// target=x86_64-linux22// target=x86_64-linux
test/cases/safety/zero casted to error.zig +1-1
...@@ -15,5 +15,5 @@ fn bar(x: u16) anyerror {...@@ -15,5 +15,5 @@ fn bar(x: u16) anyerror {
15 return @errorFromInt(x);15 return @errorFromInt(x);
16}16}
17// run17// run
18// backend=stage2,llvm18// backend=selfhosted,llvm
19// target=x86_64-linux,aarch64-linux19// target=x86_64-linux,aarch64-linux
test/cases/simple_addition_and_subtraction.zig created+21
...@@ -0,0 +1,21 @@
1fn add(a: i32, b: i32) i32 {
2 return a + b;
3}
4
5pub fn main() void {
6 var a: i32 = -5;
7 _ = &a;
8 const x = add(a, 7);
9 var y = add(2, 0);
10 y -= x;
11 assert(y == 0);
12}
13
14fn assert(ok: bool) void {
15 if (!ok) unreachable;
16}
17
18// run
19// backend=selfhosted,llvm
20// target=x86_64-linux,x86_64-macos
21//
test/cases/simple_if_statement.zig created+16
...@@ -0,0 +1,16 @@
1fn add(a: i32, b: i32) i32 {
2 return a + b;
3}
4
5fn assert(ok: bool) void {
6 if (!ok) unreachable;
7}
8
9pub fn main() void {
10 assert(add(1, 2) == 3);
11}
12
13// run
14// backend=selfhosted,llvm
15// target=x86_64-linux,x86_64-macos
16//
test/cases/spirv_mergable_pointers.zig+1-1
...@@ -12,6 +12,6 @@ export fn a() void {...@@ -12,6 +12,6 @@ export fn a() void {
1212
13// compile13// compile
14// output_mode=Obj14// output_mode=Obj
15// backend=stage215// backend=selfhosted
16// target=spirv64-vulkan16// target=spirv64-vulkan
17// emit_bin=false17// emit_bin=false
test/cases/taking_pointer_of_global_tagged_union.zig+1-1
...@@ -22,5 +22,5 @@ pub fn main() !void {...@@ -22,5 +22,5 @@ pub fn main() !void {
22}22}
2323
24// run24// run
25// backend=stage2,llvm25// backend=selfhosted,llvm
26// target=x86_64-linux26// target=x86_64-linux
test/cases/union_unresolved_layout.zig+1-1
...@@ -11,5 +11,5 @@ pub fn main() !void {...@@ -11,5 +11,5 @@ pub fn main() !void {
11}11}
1212
13// run13// run
14// backend=stage2,llvm14// backend=selfhosted,llvm
15//15//
test/cases/while_loops.zig created+18
...@@ -0,0 +1,18 @@
1fn assert(ok: bool) void {
2 if (!ok) unreachable;
3}
4
5pub fn main() void {
6 var sum: u32 = 0;
7 var i: u32 = 0;
8 while (i < 5) : (i += 1) {
9 sum += i;
10 }
11 assert(sum == 10);
12 assert(i == 5);
13}
14
15// run
16// backend=selfhosted,llvm
17// target=x86_64-linux,x86_64-macos
18//
test/compare_output.zig deleted-221
...@@ -1,221 +0,0 @@
1const std = @import("std");
2const os = std.os;
3const tests = @import("tests.zig");
4
5pub fn addCases(cases: *tests.CompareOutputContext) void {
6 cases.addC("hello world with libc",
7 \\const c = @cImport({
8 \\ // See https://github.com/ziglang/zig/issues/515
9 \\ @cDefine("_NO_CRT_STDIO_INLINE", "1");
10 \\ @cInclude("stdio.h");
11 \\});
12 \\pub export fn main(argc: c_int, argv: [*][*]u8) c_int {
13 \\ _ = argc;
14 \\ _ = argv;
15 \\ _ = c.puts("Hello, world!");
16 \\ return 0;
17 \\}
18 , "Hello, world!" ++ if (@import("builtin").os.tag == .windows) "\r\n" else "\n");
19
20 cases.addC("number literals",
21 \\const std = @import("std");
22 \\const builtin = @import("builtin");
23 \\const is_windows = builtin.os.tag == .windows;
24 \\const c = @cImport({
25 \\ if (is_windows) {
26 \\ // See https://github.com/ziglang/zig/issues/515
27 \\ @cDefine("_NO_CRT_STDIO_INLINE", "1");
28 \\ @cInclude("io.h");
29 \\ @cInclude("fcntl.h");
30 \\ }
31 \\ @cInclude("stdio.h");
32 \\});
33 \\
34 \\pub export fn main(argc: c_int, argv: [*][*]u8) c_int {
35 \\ _ = argc;
36 \\ _ = argv;
37 \\ if (is_windows) {
38 \\ // we want actual \n, not \r\n
39 \\ _ = c._setmode(1, c._O_BINARY);
40 \\ }
41 \\ _ = c.printf("0: %llu\n",
42 \\ @as(u64, 0));
43 \\ _ = c.printf("320402575052271: %llu\n",
44 \\ @as(u64, 320402575052271));
45 \\ _ = c.printf("0x01236789abcdef: %llu\n",
46 \\ @as(u64, 0x01236789abcdef));
47 \\ _ = c.printf("0xffffffffffffffff: %llu\n",
48 \\ @as(u64, 0xffffffffffffffff));
49 \\ _ = c.printf("0x000000ffffffffffffffff: %llu\n",
50 \\ @as(u64, 0x000000ffffffffffffffff));
51 \\ _ = c.printf("0o1777777777777777777777: %llu\n",
52 \\ @as(u64, 0o1777777777777777777777));
53 \\ _ = c.printf("0o0000001777777777777777777777: %llu\n",
54 \\ @as(u64, 0o0000001777777777777777777777));
55 \\ _ = c.printf("0b1111111111111111111111111111111111111111111111111111111111111111: %llu\n",
56 \\ @as(u64, 0b1111111111111111111111111111111111111111111111111111111111111111));
57 \\ _ = c.printf("0b0000001111111111111111111111111111111111111111111111111111111111111111: %llu\n",
58 \\ @as(u64, 0b0000001111111111111111111111111111111111111111111111111111111111111111));
59 \\
60 \\ _ = c.printf("\n");
61 \\
62 \\ _ = c.printf("0.0: %.013a\n",
63 \\ @as(f64, 0.0));
64 \\ _ = c.printf("0e0: %.013a\n",
65 \\ @as(f64, 0e0));
66 \\ _ = c.printf("0.0e0: %.013a\n",
67 \\ @as(f64, 0.0e0));
68 \\ _ = c.printf("000000000000000000000000000000000000000000000000000000000.0e0: %.013a\n",
69 \\ @as(f64, 0.0e0));
70 \\ _ = c.printf("0.000000000000000000000000000000000000000000000000000000000e0: %.013a\n",
71 \\ @as(f64, 0.000000000000000000000000000000000000000000000000000000000e0));
72 \\ _ = c.printf("0.0e000000000000000000000000000000000000000000000000000000000: %.013a\n",
73 \\ @as(f64, 0.0e000000000000000000000000000000000000000000000000000000000));
74 \\ _ = c.printf("1.0: %.013a\n",
75 \\ @as(f64, 1.0));
76 \\ _ = c.printf("10.0: %.013a\n",
77 \\ @as(f64, 10.0));
78 \\ _ = c.printf("10.5: %.013a\n",
79 \\ @as(f64, 10.5));
80 \\ _ = c.printf("10.5e5: %.013a\n",
81 \\ @as(f64, 10.5e5));
82 \\ _ = c.printf("10.5e+5: %.013a\n",
83 \\ @as(f64, 10.5e+5));
84 \\ _ = c.printf("50.0e-2: %.013a\n",
85 \\ @as(f64, 50.0e-2));
86 \\ _ = c.printf("50e-2: %.013a\n",
87 \\ @as(f64, 50e-2));
88 \\
89 \\ _ = c.printf("\n");
90 \\
91 \\ _ = c.printf("0x1.0: %.013a\n",
92 \\ @as(f64, 0x1.0));
93 \\ _ = c.printf("0x10.0: %.013a\n",
94 \\ @as(f64, 0x10.0));
95 \\ _ = c.printf("0x100.0: %.013a\n",
96 \\ @as(f64, 0x100.0));
97 \\ _ = c.printf("0x103.0: %.013a\n",
98 \\ @as(f64, 0x103.0));
99 \\ _ = c.printf("0x103.7: %.013a\n",
100 \\ @as(f64, 0x103.7));
101 \\ _ = c.printf("0x103.70: %.013a\n",
102 \\ @as(f64, 0x103.70));
103 \\ _ = c.printf("0x103.70p4: %.013a\n",
104 \\ @as(f64, 0x103.70p4));
105 \\ _ = c.printf("0x103.70p5: %.013a\n",
106 \\ @as(f64, 0x103.70p5));
107 \\ _ = c.printf("0x103.70p+5: %.013a\n",
108 \\ @as(f64, 0x103.70p+5));
109 \\ _ = c.printf("0x103.70p-5: %.013a\n",
110 \\ @as(f64, 0x103.70p-5));
111 \\
112 \\ return 0;
113 \\}
114 ,
115 \\0: 0
116 \\320402575052271: 320402575052271
117 \\0x01236789abcdef: 320402575052271
118 \\0xffffffffffffffff: 18446744073709551615
119 \\0x000000ffffffffffffffff: 18446744073709551615
120 \\0o1777777777777777777777: 18446744073709551615
121 \\0o0000001777777777777777777777: 18446744073709551615
122 \\0b1111111111111111111111111111111111111111111111111111111111111111: 18446744073709551615
123 \\0b0000001111111111111111111111111111111111111111111111111111111111111111: 18446744073709551615
124 \\
125 \\0.0: 0x0.0000000000000p+0
126 \\0e0: 0x0.0000000000000p+0
127 \\0.0e0: 0x0.0000000000000p+0
128 \\000000000000000000000000000000000000000000000000000000000.0e0: 0x0.0000000000000p+0
129 \\0.000000000000000000000000000000000000000000000000000000000e0: 0x0.0000000000000p+0
130 \\0.0e000000000000000000000000000000000000000000000000000000000: 0x0.0000000000000p+0
131 \\1.0: 0x1.0000000000000p+0
132 \\10.0: 0x1.4000000000000p+3
133 \\10.5: 0x1.5000000000000p+3
134 \\10.5e5: 0x1.0059000000000p+20
135 \\10.5e+5: 0x1.0059000000000p+20
136 \\50.0e-2: 0x1.0000000000000p-1
137 \\50e-2: 0x1.0000000000000p-1
138 \\
139 \\0x1.0: 0x1.0000000000000p+0
140 \\0x10.0: 0x1.0000000000000p+4
141 \\0x100.0: 0x1.0000000000000p+8
142 \\0x103.0: 0x1.0300000000000p+8
143 \\0x103.7: 0x1.0370000000000p+8
144 \\0x103.70: 0x1.0370000000000p+8
145 \\0x103.70p4: 0x1.0370000000000p+12
146 \\0x103.70p5: 0x1.0370000000000p+13
147 \\0x103.70p+5: 0x1.0370000000000p+13
148 \\0x103.70p-5: 0x1.0370000000000p+3
149 \\
150 );
151
152 cases.addC("expose function pointer to C land",
153 \\const c = @cImport(@cInclude("stdlib.h"));
154 \\
155 \\export fn compare_fn(a: ?*const anyopaque, b: ?*const anyopaque) c_int {
156 \\ const a_int: *const i32 = @ptrCast(@alignCast(a));
157 \\ const b_int: *const i32 = @ptrCast(@alignCast(b));
158 \\ if (a_int.* < b_int.*) {
159 \\ return -1;
160 \\ } else if (a_int.* > b_int.*) {
161 \\ return 1;
162 \\ } else {
163 \\ return 0;
164 \\ }
165 \\}
166 \\
167 \\pub export fn main() c_int {
168 \\ var array = [_]u32{ 1, 7, 3, 2, 0, 9, 4, 8, 6, 5 };
169 \\
170 \\ c.qsort(@ptrCast(&array), @intCast(array.len), @sizeOf(i32), compare_fn);
171 \\
172 \\ for (array, 0..) |item, i| {
173 \\ if (item != i) {
174 \\ c.abort();
175 \\ }
176 \\ }
177 \\
178 \\ return 0;
179 \\}
180 , "");
181
182 cases.addC("casting between float and integer types",
183 \\const std = @import("std");
184 \\const builtin = @import("builtin");
185 \\const is_windows = builtin.os.tag == .windows;
186 \\const c = @cImport({
187 \\ if (is_windows) {
188 \\ // See https://github.com/ziglang/zig/issues/515
189 \\ @cDefine("_NO_CRT_STDIO_INLINE", "1");
190 \\ @cInclude("io.h");
191 \\ @cInclude("fcntl.h");
192 \\ }
193 \\ @cInclude("stdio.h");
194 \\});
195 \\
196 \\pub export fn main(argc: c_int, argv: [*][*]u8) c_int {
197 \\ _ = argc;
198 \\ _ = argv;
199 \\ if (is_windows) {
200 \\ // we want actual \n, not \r\n
201 \\ _ = c._setmode(1, c._O_BINARY);
202 \\ }
203 \\ const small: f32 = 3.25;
204 \\ const x: f64 = small;
205 \\ const y: i32 = @intFromFloat(x);
206 \\ const z: f64 = @floatFromInt(y);
207 \\ _ = c.printf("%.2f\n%d\n%.2f\n%.2f\n", x, y, z, @as(f64, -0.4));
208 \\ return 0;
209 \\}
210 , "3.25\n3\n3.00\n-0.40\n");
211
212 cases.add("valid carriage return example", "const std = @import(\"std\");\r\n" ++ // Testing CRLF line endings are valid
213 "\r\n" ++
214 "pub \r fn main() void {\r\n" ++ // Testing isolated carriage return as whitespace is valid
215 " var file_writer = std.fs.File.stdout().writerStreaming(&.{});\r\n" ++
216 " const stdout = &file_writer.interface;\r\n" ++
217 " stdout.print(\\\\A Multiline\r\n" ++ // testing CRLF at end of multiline string line is valid and normalises to \n in the output
218 " \\\\String\r\n" ++
219 " , .{}) catch unreachable;\r\n" ++
220 "}\r\n", "A Multiline\nString");
221}
test/link/build.zig.zon-3
...@@ -15,9 +15,6 @@...@@ -15,9 +15,6 @@
15 .static_libs_from_object_files = .{15 .static_libs_from_object_files = .{
16 .path = "static_libs_from_object_files",16 .path = "static_libs_from_object_files",
17 },17 },
18 .glibc_compat = .{
19 .path = "glibc_compat",
20 },
21 // WASM Cases18 // WASM Cases
22 .wasm_archive = .{19 .wasm_archive = .{
23 .path = "wasm/archive",20 .path = "wasm/archive",
test/link/glibc_compat/build.zig deleted-262
...@@ -1,262 +0,0 @@
1const std = @import("std");
2const builtin = @import("builtin");
3
4// To run executables linked against a specific glibc version, the
5// run-time glibc version needs to be new enough. Check the host's glibc
6// version. Note that this does not allow for translation/vm/emulation
7// services to run these tests.
8const running_glibc_ver = builtin.os.versionRange().gnuLibCVersion();
9
10pub fn build(b: *std.Build) void {
11 const test_step = b.step("test", "Test");
12 b.default_step = test_step;
13
14 for ([_][]const u8{ "aarch64-linux-gnu.2.27", "aarch64-linux-gnu.2.34" }) |t| {
15 const exe = b.addExecutable(.{
16 .name = t,
17 .root_module = b.createModule(.{
18 .root_source_file = null,
19 .target = b.resolveTargetQuery(std.Target.Query.parse(
20 .{ .arch_os_abi = t },
21 ) catch unreachable),
22 .link_libc = true,
23 }),
24 });
25 // We disable UBSAN for these tests as the libc being tested here is
26 // so old, it doesn't even support compiling our UBSAN implementation.
27 exe.bundle_ubsan_rt = false;
28 exe.root_module.sanitize_c = .off;
29 exe.root_module.addCSourceFile(.{ .file = b.path("main.c") });
30 // TODO: actually test the output
31 _ = exe.getEmittedBin();
32 test_step.dependOn(&exe.step);
33 }
34
35 // Build & run a C test case against a sampling of supported glibc versions
36 versions: for ([_][]const u8{
37 // "native-linux-gnu.2.0", // fails with a pile of missing symbols.
38 "native-linux-gnu.2.2.5",
39 "native-linux-gnu.2.4",
40 "native-linux-gnu.2.12",
41 "native-linux-gnu.2.16",
42 "native-linux-gnu.2.22",
43 "native-linux-gnu.2.28",
44 "native-linux-gnu.2.33",
45 "native-linux-gnu.2.38",
46 "native-linux-gnu",
47 }) |t| {
48 const target = b.resolveTargetQuery(std.Target.Query.parse(
49 .{ .arch_os_abi = t },
50 ) catch unreachable);
51
52 const glibc_ver = target.result.os.version_range.linux.glibc;
53
54 // only build test if glibc version supports the architecture
55 for (std.zig.target.available_libcs) |libc| {
56 if (libc.arch != target.result.cpu.arch or
57 libc.os != target.result.os.tag or
58 libc.abi != target.result.abi)
59 continue;
60
61 if (libc.glibc_min) |min| {
62 if (glibc_ver.order(min) == .lt) continue :versions;
63 }
64 }
65
66 const exe = b.addExecutable(.{
67 .name = t,
68 .root_module = b.createModule(.{
69 .root_source_file = null,
70 .target = target,
71 .link_libc = true,
72 }),
73 });
74 // We disable UBSAN for these tests as the libc being tested here is
75 // so old, it doesn't even support compiling our UBSAN implementation.
76 exe.bundle_ubsan_rt = false;
77 exe.root_module.sanitize_c = .off;
78 exe.root_module.addCSourceFile(.{ .file = b.path("glibc_runtime_check.c") });
79
80 // Only try running the test if the host glibc is known to be good enough. Ideally, the Zig
81 // test runner would be able to check this, but see https://github.com/ziglang/zig/pull/17702#issuecomment-1831310453
82 if (running_glibc_ver) |running_ver| {
83 if (glibc_ver.order(running_ver) == .lt) {
84 const run_cmd = b.addRunArtifact(exe);
85 run_cmd.skip_foreign_checks = true;
86 run_cmd.expectExitCode(0);
87
88 test_step.dependOn(&run_cmd.step);
89 }
90 }
91 const check = exe.checkObject();
92
93 // __errno_location is always a dynamically linked symbol
94 check.checkInDynamicSymtab();
95 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __errno_location");
96
97 // before v2.32 fstat redirects through __fxstat, afterwards its a
98 // normal dynamic symbol
99 check.checkInDynamicSymtab();
100 if (glibc_ver.order(.{ .major = 2, .minor = 32, .patch = 0 }) == .lt) {
101 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __fxstat");
102
103 check.checkInSymtab();
104 check.checkContains("FUNC LOCAL HIDDEN fstat");
105 } else {
106 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT fstat");
107
108 check.checkInSymtab();
109 check.checkNotPresent("__fxstat");
110 }
111
112 // before v2.26 reallocarray is not supported
113 check.checkInDynamicSymtab();
114 if (glibc_ver.order(.{ .major = 2, .minor = 26, .patch = 0 }) == .lt) {
115 check.checkNotPresent("reallocarray");
116 } else {
117 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT reallocarray");
118 }
119
120 // before v2.38 strlcpy is not supported
121 check.checkInDynamicSymtab();
122 if (glibc_ver.order(.{ .major = 2, .minor = 38, .patch = 0 }) == .lt) {
123 check.checkNotPresent("strlcpy");
124 } else {
125 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT strlcpy");
126 }
127
128 // v2.16 introduced getauxval()
129 check.checkInDynamicSymtab();
130 if (glibc_ver.order(.{ .major = 2, .minor = 16, .patch = 0 }) == .lt) {
131 check.checkNotPresent("getauxval");
132 } else {
133 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT getauxval");
134 }
135
136 // Always have dynamic "exit", "pow", and "powf" references
137 check.checkInDynamicSymtab();
138 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT exit");
139 check.checkInDynamicSymtab();
140 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT pow");
141 check.checkInDynamicSymtab();
142 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT powf");
143
144 // An atexit local symbol is defined, and depends on undefined dynamic
145 // __cxa_atexit.
146 check.checkInSymtab();
147 check.checkContains("FUNC LOCAL HIDDEN atexit");
148 check.checkInDynamicSymtab();
149 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __cxa_atexit");
150
151 test_step.dependOn(&check.step);
152 }
153
154 // Build & run a Zig test case against a sampling of supported glibc versions
155 versions: for ([_][]const u8{
156 "native-linux-gnu.2.17", // Currently oldest supported, see #17769
157 "native-linux-gnu.2.23",
158 "native-linux-gnu.2.28",
159 "native-linux-gnu.2.33",
160 "native-linux-gnu.2.38",
161 "native-linux-gnu",
162 }) |t| {
163 const target = b.resolveTargetQuery(std.Target.Query.parse(
164 .{ .arch_os_abi = t },
165 ) catch unreachable);
166
167 const glibc_ver = target.result.os.version_range.linux.glibc;
168
169 // only build test if glibc version supports the architecture
170 for (std.zig.target.available_libcs) |libc| {
171 if (libc.arch != target.result.cpu.arch or
172 libc.os != target.result.os.tag or
173 libc.abi != target.result.abi)
174 continue;
175
176 if (libc.glibc_min) |min| {
177 if (glibc_ver.order(min) == .lt) continue :versions;
178 }
179 }
180
181 const exe = b.addExecutable(.{
182 .name = t,
183 .root_module = b.createModule(.{
184 .root_source_file = b.path("glibc_runtime_check.zig"),
185 .target = target,
186 .link_libc = true,
187 }),
188 });
189 // We disable UBSAN for these tests as the libc being tested here is
190 // so old, it doesn't even support compiling our UBSAN implementation.
191 exe.bundle_ubsan_rt = false;
192 exe.root_module.sanitize_c = .off;
193
194 // Only try running the test if the host glibc is known to be good enough. Ideally, the Zig
195 // test runner would be able to check this, but see https://github.com/ziglang/zig/pull/17702#issuecomment-1831310453
196 if (running_glibc_ver) |running_ver| {
197 if (glibc_ver.order(running_ver) == .lt) {
198 const run_cmd = b.addRunArtifact(exe);
199 run_cmd.skip_foreign_checks = true;
200 run_cmd.expectExitCode(0);
201
202 test_step.dependOn(&run_cmd.step);
203 }
204 }
205 const check = exe.checkObject();
206
207 // __errno_location is always a dynamically linked symbol
208 check.checkInDynamicSymtab();
209 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __errno_location");
210
211 // before v2.32 fstatat redirects through __fxstatat, afterwards its a
212 // normal dynamic symbol
213 if (glibc_ver.order(.{ .major = 2, .minor = 32, .patch = 0 }) == .lt) {
214 check.checkInDynamicSymtab();
215 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __fxstatat");
216
217 check.checkInSymtab();
218 check.checkContains("FUNC LOCAL HIDDEN fstatat");
219 } else {
220 check.checkInDynamicSymtab();
221 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT fstatat");
222
223 check.checkInSymtab();
224 check.checkNotPresent("FUNC LOCAL HIDDEN fstatat");
225 }
226
227 // before v2.26 reallocarray is not supported
228 if (glibc_ver.order(.{ .major = 2, .minor = 26, .patch = 0 }) == .lt) {
229 check.checkInDynamicSymtab();
230 check.checkNotPresent("reallocarray");
231 } else {
232 check.checkInDynamicSymtab();
233 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT reallocarray");
234 }
235
236 // before v2.38 strlcpy is not supported
237 if (glibc_ver.order(.{ .major = 2, .minor = 38, .patch = 0 }) == .lt) {
238 check.checkInDynamicSymtab();
239 check.checkNotPresent("strlcpy");
240 } else {
241 check.checkInDynamicSymtab();
242 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT strlcpy");
243 }
244
245 // v2.16 introduced getauxval(), so always present
246 check.checkInDynamicSymtab();
247 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT getauxval");
248
249 // Always have a dynamic "exit" reference
250 check.checkInDynamicSymtab();
251 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT exit");
252
253 // An atexit local symbol is defined, and depends on undefined dynamic
254 // __cxa_atexit.
255 check.checkInSymtab();
256 check.checkContains("FUNC LOCAL HIDDEN atexit");
257 check.checkInDynamicSymtab();
258 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __cxa_atexit");
259
260 test_step.dependOn(&check.step);
261 }
262}
test/link/glibc_compat/glibc_runtime_check.c deleted-114
...@@ -1,114 +0,0 @@
1/*
2 * Exercise complicating glibc symbols from C code. Complicating symbols
3 * are ones that have moved between glibc versions, or use floating point
4 * parameters, or have otherwise tripped up the Zig glibc compatibility
5 * code.
6 */
7#include <assert.h>
8#include <errno.h>
9#include <features.h>
10#include <fcntl.h>
11#include <math.h>
12#include <stdio.h>
13#include <stdlib.h>
14#include <string.h>
15#include <sys/auxv.h>
16#include <sys/stat.h>
17#include <unistd.h>
18
19/* errno is compilcated (thread-local, dynamically provided, etc). */
20static void check_errno()
21{
22 int invalid_fd = open("/doesnotexist", O_RDONLY);
23 assert(invalid_fd == -1);
24 assert(errno == ENOENT);
25}
26
27/* fstat has moved around in glibc (between libc_nonshared and libc) */
28static void check_fstat()
29{
30 int self_fd = open("/proc/self/exe", O_RDONLY);
31
32 struct stat statbuf = {0};
33 int rc = fstat(self_fd, &statbuf);
34
35 assert(rc == 0);
36
37 assert(statbuf.st_dev != 0);
38 assert(statbuf.st_ino != 0);
39 assert(statbuf.st_mode != 0);
40 assert(statbuf.st_size > 0);
41 assert(statbuf.st_blocks > 0);
42 assert(statbuf.st_ctim.tv_sec > 0);
43
44 close(self_fd);
45}
46
47/* Some targets have a complicated ABI for floats and doubles */
48static void check_fp_abi()
49{
50 // Picked "pow" as it takes and returns doubles
51 assert(pow(10.0, 10.0) == 10000000000.0);
52 assert(powf(10.0f, 10.0f) == 10000000000.0f);
53}
54
55/* strlcpy introduced in glibc 2.38 */
56static void check_strlcpy()
57{
58#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || (__GLIBC__ > 2)
59 char target[4] = {0};
60 strlcpy(target, "this is a source string", 4);
61
62 assert(strcmp(target, "thi") == 0);
63#endif
64}
65
66/* reallocarray introduced in glibc 2.26 */
67static void check_reallocarray()
68{
69#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 26) || (__GLIBC__ > 2)
70 const size_t el_size = 32;
71 void* base = reallocarray(NULL, 10, el_size);
72 void* grown = reallocarray(base, 100, el_size);
73
74 assert(base != NULL);
75 assert(grown != NULL);
76
77 free(grown);
78#endif
79}
80
81/* getauxval introduced in glibc 2.16 */
82static void check_getauxval()
83{
84#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16) || (__GLIBC__ > 2)
85 int pgsz = getauxval(AT_PAGESZ);
86 assert(pgsz >= 4*1024);
87#endif
88}
89
90/* atexit() is part of libc_nonshared */
91static void force_exit_0()
92{
93 exit(0);
94}
95
96static void check_atexit()
97{
98 int rc = atexit(force_exit_0);
99 assert(rc == 0);
100}
101
102int main() {
103 int rc;
104
105 check_errno();
106 check_fstat();
107 check_fp_abi();
108 check_strlcpy();
109 check_reallocarray();
110 check_getauxval();
111 check_atexit();
112
113 exit(99); // exit code overridden by atexit handler
114}
test/link/glibc_compat/glibc_runtime_check.zig deleted-116
...@@ -1,116 +0,0 @@
1// A zig test case that exercises some glibc symbols that have uncovered
2// problems in the past. This test must be compiled against a glibc.
3//
4// The build.zig tests the binary built from this source to see that
5// symbols are statically or dynamically linked, as expected.
6
7const std = @import("std");
8const builtin = @import("builtin");
9const assert = std.debug.assert;
10
11const c_malloc = @cImport(
12 @cInclude("malloc.h"), // for reallocarray
13);
14
15const c_stdlib = @cImport(
16 @cInclude("stdlib.h"), // for atexit
17);
18
19const c_string = @cImport(
20 @cInclude("string.h"), // for strlcpy
21);
22
23// Version of glibc this test is being built to run against
24const glibc_ver = builtin.os.versionRange().gnuLibCVersion().?;
25
26// PR #17034 - fstat moved between libc_nonshared and libc
27fn checkStat() !void {
28 const cwdFd = std.fs.cwd().fd;
29
30 var stat = std.mem.zeroes(std.c.Stat);
31 var result = std.c.fstatat(cwdFd, "a_file_that_definitely_does_not_exist", &stat, 0);
32 assert(result == -1);
33 assert(std.posix.errno(result) == .NOENT);
34
35 result = std.c.stat("a_file_that_definitely_does_not_exist", &stat);
36 assert(result == -1);
37 assert(std.posix.errno(result) == .NOENT);
38}
39
40// PR #17607 - reallocarray not visible in headers
41fn checkReallocarray() !void {
42 // reallocarray was introduced in v2.26
43 if (comptime glibc_ver.order(.{ .major = 2, .minor = 26, .patch = 0 }) == .lt) {
44 if (@hasDecl(c_malloc, "reallocarray")) {
45 @compileError("Before v2.26 'malloc.h' does not define 'reallocarray'");
46 }
47 } else {
48 return try checkReallocarray_v2_26();
49 }
50}
51
52fn checkReallocarray_v2_26() !void {
53 const size = 16;
54 const tenX = c_malloc.reallocarray(c_malloc.NULL, 10, size);
55 const elevenX = c_malloc.reallocarray(tenX, 11, size);
56
57 assert(tenX != c_malloc.NULL);
58 assert(elevenX != c_malloc.NULL);
59}
60
61// getauxval introduced in v2.16
62fn checkGetAuxVal() !void {
63 if (comptime glibc_ver.order(.{ .major = 2, .minor = 16, .patch = 0 }) == .lt) {
64 if (@hasDecl(std.c, "getauxval")) {
65 @compileError("Before v2.16 glibc does not define 'getauxval'");
66 }
67 } else {
68 try checkGetAuxVal_v2_16();
69 }
70}
71
72fn checkGetAuxVal_v2_16() !void {
73 const base = std.c.getauxval(std.elf.AT_BASE);
74 const pgsz = std.c.getauxval(std.elf.AT_PAGESZ);
75
76 assert(base != 0);
77 assert(pgsz != 0);
78}
79
80// strlcpy introduced in v2.38, which is newer than many installed glibcs
81fn checkStrlcpy() !void {
82 if (comptime glibc_ver.order(.{ .major = 2, .minor = 38, .patch = 0 }) == .lt) {
83 if (@hasDecl(c_string, "strlcpy")) {
84 @compileError("Before v2.38 glibc does not define 'strlcpy'");
85 }
86 } else {
87 try checkStrlcpy_v2_38();
88 }
89}
90
91fn checkStrlcpy_v2_38() !void {
92 var buf: [99]u8 = undefined;
93 const used = c_string.strlcpy(&buf, "strlcpy works!", buf.len);
94 assert(used == 14);
95}
96
97// atexit is part of libc_nonshared, so ensure its linked in correctly
98fn forceExit0Callback() callconv(.c) void {
99 std.c.exit(0); // Override the main() exit code
100}
101
102fn checkAtExit() !void {
103 const result = c_stdlib.atexit(forceExit0Callback);
104 assert(result == 0);
105}
106
107pub fn main() !u8 {
108 try checkStat();
109 try checkReallocarray();
110 try checkStrlcpy();
111
112 try checkGetAuxVal();
113 try checkAtExit();
114
115 std.c.exit(1); // overridden by atexit() callback
116}
test/link/glibc_compat/main.c deleted-40
...@@ -1,40 +0,0 @@
1#define _FILE_OFFSET_BITS 64
2#include <unistd.h>
3#include <fcntl.h>
4#include <stdio.h>
5#include <resolv.h>
6
7int main() {
8 /* in glibc 2.28+ and _FILE_OFFSET_BITS=64 fcntl is #define'd to fcntl64
9 * Thus headers say `fcntl64` exists, but libc.so.6 (the old one)
10 * disagrees, resulting in a linking error unless headers are made
11 * backwards-compatible.
12 *
13 * Glibc 2.28+:
14 * FUNC GLOBAL DEFAULT UND fcntl64@GLIBC_2.28 (3):
15 *
16 * Glibc 2.27 or older:
17 * FUNC GLOBAL DEFAULT UND fcntl@GLIBC_2.2.5
18 */
19 printf("address to fcntl: %p\n", fcntl);
20
21 /* The following functions became symbols of their own right with glibc
22 * 2.34+. Before 2.34 resolv.h would #define res_search __res_search; and
23 * __res_search is a valid symbol since the beginning of time.
24 *
25 * On glibc 2.34+ these symbols are linked this way:
26 * FUNC GLOBAL DEFAULT UND res_search@GLIBC_2.34 (2)
27 *
28 * Pre-glibc 2.34:
29 * FUNC GLOBAL DEFAULT UND __res_search@GLIBC_2.2.5 (4)
30 */
31 printf("address to res_search: %p\n", res_search);
32 printf("address to res_nsearch: %p\n", res_nsearch);
33 printf("address to res_query: %p\n", res_query);
34 printf("address to res_nquery: %p\n", res_nquery);
35 printf("address to res_querydomain: %p\n", res_querydomain);
36 printf("address to res_nquerydomain: %p\n", res_nquerydomain);
37 printf("address to dn_skipname: %p\n", dn_skipname);
38 printf("address to dn_comp: %p\n", dn_comp);
39 printf("address to dn_expand: %p\n", dn_expand);
40}
test/link/interdependent_static_c_libs/main.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const std = @import("std");1const std = @import("std");
2const expect = std.testing.expect;2const expect = std.testing.expect;
3const c = @cImport(@cInclude("b.h"));3
4extern fn sub(a: i32, b: i32) i32;
45
5test "import C sub" {6test "import C sub" {
6 const result = c.sub(2, 1);7 const result = sub(2, 1);
7 try expect(result == 1);8 try expect(result == 1);
8}9}
test/src/Cases.zig+19-30
...@@ -26,8 +26,9 @@ pub const DepModule = struct {...@@ -26,8 +26,9 @@ pub const DepModule = struct {
26};26};
2727
28pub const Backend = enum {28pub const Backend = enum {
29 stage1,29 /// Test does not care which backend is used; compiler gets to pick the default.
30 stage2,30 auto,
31 selfhosted,
31 llvm,32 llvm,
32};33};
3334
...@@ -75,7 +76,7 @@ pub const Case = struct {...@@ -75,7 +76,7 @@ pub const Case = struct {
75 emit_h: bool = false,76 emit_h: bool = false,
76 is_test: bool = false,77 is_test: bool = false,
77 expect_exact: bool = false,78 expect_exact: bool = false,
78 backend: Backend = .stage2,79 backend: Backend = .auto,
79 link_libc: bool = false,80 link_libc: bool = false,
80 pic: ?bool = null,81 pic: ?bool = null,
81 pie: ?bool = null,82 pie: ?bool = null,
...@@ -271,26 +272,6 @@ pub fn addC(ctx: *Cases, name: []const u8, target: std.Build.ResolvedTarget) *Ca...@@ -271,26 +272,6 @@ pub fn addC(ctx: *Cases, name: []const u8, target: std.Build.ResolvedTarget) *Ca
271 return &ctx.cases.items[ctx.cases.items.len - 1];272 return &ctx.cases.items[ctx.cases.items.len - 1];
272}273}
273274
274pub fn addCompareOutput(
275 ctx: *Cases,
276 name: []const u8,
277 src: [:0]const u8,
278 expected_stdout: []const u8,
279) void {
280 ctx.addExe(name, .{}).addCompareOutput(src, expected_stdout);
281}
282
283/// Adds a test case that compiles the Zig source given in `src`, executes
284/// it, runs it, and tests the output against `expected_stdout`
285pub fn compareOutput(
286 ctx: *Cases,
287 name: []const u8,
288 src: [:0]const u8,
289 expected_stdout: []const u8,
290) void {
291 return ctx.addCompareOutput(name, src, expected_stdout);
292}
293
294pub fn addTransform(275pub fn addTransform(
295 ctx: *Cases,276 ctx: *Cases,
296 name: []const u8,277 name: []const u8,
...@@ -443,13 +424,13 @@ fn addFromDirInner(...@@ -443,13 +424,13 @@ fn addFromDirInner(
443 const resolved_target = b.resolveTargetQuery(target_query);424 const resolved_target = b.resolveTargetQuery(target_query);
444 const target = &resolved_target.result;425 const target = &resolved_target.result;
445 for (backends) |backend| {426 for (backends) |backend| {
446 if (backend == .stage2 and427 if (backend == .selfhosted and
447 target.cpu.arch != .aarch64 and target.cpu.arch != .wasm32 and target.cpu.arch != .x86_64 and target.cpu.arch != .spirv64)428 target.cpu.arch != .aarch64 and target.cpu.arch != .wasm32 and target.cpu.arch != .x86_64 and target.cpu.arch != .spirv64)
448 {429 {
449 // Other backends don't support new liveness format430 // Other backends don't support new liveness format
450 continue;431 continue;
451 }432 }
452 if (backend == .stage2 and target.os.tag == .macos and433 if (backend == .selfhosted and target.os.tag == .macos and
453 target.cpu.arch == .x86_64 and builtin.cpu.arch == .aarch64)434 target.cpu.arch == .x86_64 and builtin.cpu.arch == .aarch64)
454 {435 {
455 // Rosetta has issues with ZLD436 // Rosetta has issues with ZLD
...@@ -638,7 +619,15 @@ pub fn lowerToBuildSteps(...@@ -638,7 +619,15 @@ pub fn lowerToBuildSteps(
638 if (options.skip_macos and case.target.query.os_tag == .macos) continue;619 if (options.skip_macos and case.target.query.os_tag == .macos) continue;
639 if (options.skip_linux and case.target.query.os_tag == .linux) continue;620 if (options.skip_linux and case.target.query.os_tag == .linux) continue;
640621
641 const would_use_llvm = @import("../tests.zig").wouldUseLlvm(case.backend == .llvm, case.target.query, case.optimize_mode);622 const would_use_llvm = @import("../tests.zig").wouldUseLlvm(
623 switch (case.backend) {
624 .auto => null,
625 .selfhosted => false,
626 .llvm => true,
627 },
628 case.target.query,
629 case.optimize_mode,
630 );
642 if (options.skip_llvm and would_use_llvm) continue;631 if (options.skip_llvm and would_use_llvm) continue;
643632
644 const triple_txt = case.target.query.zigTriple(b.allocator) catch @panic("OOM");633 const triple_txt = case.target.query.zigTriple(b.allocator) catch @panic("OOM");
...@@ -707,8 +696,8 @@ pub fn lowerToBuildSteps(...@@ -707,8 +696,8 @@ pub fn lowerToBuildSteps(
707 if (case.pie) |pie| artifact.pie = pie;696 if (case.pie) |pie| artifact.pie = pie;
708697
709 switch (case.backend) {698 switch (case.backend) {
710 .stage1 => continue,699 .auto => {},
711 .stage2 => {700 .selfhosted => {
712 artifact.use_llvm = false;701 artifact.use_llvm = false;
713 artifact.use_lld = false;702 artifact.use_lld = false;
714 },703 },
...@@ -787,7 +776,7 @@ const TestManifestConfigDefaults = struct {...@@ -787,7 +776,7 @@ const TestManifestConfigDefaults = struct {
787 /// Asserts if the key doesn't exist - yep, it's an oversight alright.776 /// Asserts if the key doesn't exist - yep, it's an oversight alright.
788 fn get(@"type": TestManifest.Type, key: []const u8) []const u8 {777 fn get(@"type": TestManifest.Type, key: []const u8) []const u8 {
789 if (std.mem.eql(u8, key, "backend")) {778 if (std.mem.eql(u8, key, "backend")) {
790 return "stage2";779 return "auto";
791 } else if (std.mem.eql(u8, key, "target")) {780 } else if (std.mem.eql(u8, key, "target")) {
792 if (@"type" == .@"error" or @"type" == .translate_c or @"type" == .run_translated_c) {781 if (@"type" == .@"error" or @"type" == .translate_c or @"type" == .run_translated_c) {
793 return "native";782 return "native";
...@@ -844,7 +833,7 @@ const TestManifestConfigDefaults = struct {...@@ -844,7 +833,7 @@ const TestManifestConfigDefaults = struct {
844/// (see https://github.com/ziglang/zig/issues/11288)833/// (see https://github.com/ziglang/zig/issues/11288)
845///834///
846/// error835/// error
847/// backend=stage1,stage2836/// backend=selfhosted,llvm
848/// output_mode=exe837/// output_mode=exe
849///838///
850/// :3:19: error: foo839/// :3:19: error: foo
test/src/CompareOutput.zig deleted-175
...@@ -1,175 +0,0 @@
1//! This is the implementation of the test harness.
2//! For the actual test cases, see test/compare_output.zig.
3
4b: *std.Build,
5step: *std.Build.Step,
6test_index: usize,
7test_filters: []const []const u8,
8optimize_modes: []const OptimizeMode,
9
10const Special = enum {
11 None,
12 Asm,
13 RuntimeSafety,
14};
15
16const TestCase = struct {
17 name: []const u8,
18 sources: std.array_list.Managed(SourceFile),
19 expected_output: []const u8,
20 link_libc: bool,
21 special: Special,
22 cli_args: []const []const u8,
23
24 const SourceFile = struct {
25 filename: []const u8,
26 source: []const u8,
27 };
28
29 pub fn addSourceFile(self: *TestCase, filename: []const u8, source: []const u8) void {
30 self.sources.append(SourceFile{
31 .filename = filename,
32 .source = source,
33 }) catch @panic("OOM");
34 }
35
36 pub fn setCommandLineArgs(self: *TestCase, args: []const []const u8) void {
37 self.cli_args = args;
38 }
39};
40
41pub fn createExtra(self: *CompareOutput, name: []const u8, source: []const u8, expected_output: []const u8, special: Special) TestCase {
42 var tc = TestCase{
43 .name = name,
44 .sources = std.array_list.Managed(TestCase.SourceFile).init(self.b.allocator),
45 .expected_output = expected_output,
46 .link_libc = false,
47 .special = special,
48 .cli_args = &[_][]const u8{},
49 };
50 const root_src_name = if (special == Special.Asm) "source.s" else "source.zig";
51 tc.addSourceFile(root_src_name, source);
52 return tc;
53}
54
55pub fn create(self: *CompareOutput, name: []const u8, source: []const u8, expected_output: []const u8) TestCase {
56 return createExtra(self, name, source, expected_output, Special.None);
57}
58
59pub fn addC(self: *CompareOutput, name: []const u8, source: []const u8, expected_output: []const u8) void {
60 var tc = self.create(name, source, expected_output);
61 tc.link_libc = true;
62 self.addCase(tc);
63}
64
65pub fn add(self: *CompareOutput, name: []const u8, source: []const u8, expected_output: []const u8) void {
66 const tc = self.create(name, source, expected_output);
67 self.addCase(tc);
68}
69
70pub fn addAsm(self: *CompareOutput, name: []const u8, source: []const u8, expected_output: []const u8) void {
71 const tc = self.createExtra(name, source, expected_output, Special.Asm);
72 self.addCase(tc);
73}
74
75pub fn addRuntimeSafety(self: *CompareOutput, name: []const u8, source: []const u8) void {
76 const tc = self.createExtra(name, source, undefined, Special.RuntimeSafety);
77 self.addCase(tc);
78}
79
80pub fn addCase(self: *CompareOutput, case: TestCase) void {
81 const b = self.b;
82
83 const write_src = b.addWriteFiles();
84 const first_src = case.sources.items[0];
85 const first_file = write_src.add(first_src.filename, first_src.source);
86 for (case.sources.items[1..]) |src_file| {
87 _ = write_src.add(src_file.filename, src_file.source);
88 }
89
90 switch (case.special) {
91 Special.Asm => {
92 const annotated_case_name = b.fmt("run assemble-and-link {s}", .{
93 case.name,
94 });
95 for (self.test_filters) |test_filter| {
96 if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
97 } else if (self.test_filters.len > 0) return;
98
99 const exe = b.addExecutable(.{
100 .name = "test",
101 .root_module = b.createModule(.{
102 .root_source_file = null,
103 .target = b.graph.host,
104 .optimize = .Debug,
105 }),
106 });
107 exe.root_module.addAssemblyFile(first_file);
108
109 const run = b.addRunArtifact(exe);
110 run.setName(annotated_case_name);
111 run.addArgs(case.cli_args);
112 run.expectStdOutEqual(case.expected_output);
113
114 self.step.dependOn(&run.step);
115 },
116 Special.None => {
117 for (self.optimize_modes) |optimize| {
118 const annotated_case_name = b.fmt("run compare-output {s} ({s})", .{
119 case.name, @tagName(optimize),
120 });
121 for (self.test_filters) |test_filter| {
122 if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
123 } else if (self.test_filters.len > 0) return;
124
125 const exe = b.addExecutable(.{
126 .name = "test",
127 .root_module = b.createModule(.{
128 .root_source_file = first_file,
129 .optimize = optimize,
130 .target = b.graph.host,
131 }),
132 });
133 if (case.link_libc) exe.root_module.link_libc = true;
134
135 const run = b.addRunArtifact(exe);
136 run.setName(annotated_case_name);
137 run.addArgs(case.cli_args);
138 run.expectStdOutEqual(case.expected_output);
139
140 self.step.dependOn(&run.step);
141 }
142 },
143 Special.RuntimeSafety => {
144 // TODO iterate over self.optimize_modes and test this in both
145 // debug and release safe mode
146 const annotated_case_name = b.fmt("run safety {s}", .{case.name});
147 for (self.test_filters) |test_filter| {
148 if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
149 } else if (self.test_filters.len > 0) return;
150
151 const exe = b.addExecutable(.{
152 .name = "test",
153 .root_module = b.createModule(.{
154 .root_source_file = first_file,
155 .target = b.graph.host,
156 .optimize = .Debug,
157 }),
158 });
159 if (case.link_libc) exe.root_module.link_libc = true;
160
161 const run = b.addRunArtifact(exe);
162 run.setName(annotated_case_name);
163 run.addArgs(case.cli_args);
164 run.expectExitCode(126);
165
166 self.step.dependOn(&run.step);
167 },
168 }
169}
170
171const CompareOutput = @This();
172const std = @import("std");
173const mem = std.mem;
174const fs = std.fs;
175const OptimizeMode = std.builtin.OptimizeMode;
test/standalone/build.zig.zon+5-2
...@@ -37,8 +37,8 @@...@@ -37,8 +37,8 @@
37 .issue_339 = .{37 .issue_339 = .{
38 .path = "issue_339",38 .path = "issue_339",
39 },39 },
40 .issue_8550 = .{40 .compile_asm = .{
41 .path = "issue_8550",41 .path = "compile_asm",
42 },42 },
43 .issue_794 = .{43 .issue_794 = .{
44 .path = "issue_794",44 .path = "issue_794",
...@@ -49,6 +49,9 @@...@@ -49,6 +49,9 @@
49 .pkg_import = .{49 .pkg_import = .{
50 .path = "pkg_import",50 .path = "pkg_import",
51 },51 },
52 .glibc_compat = .{
53 .path = "glibc_compat",
54 },
52 .install_raw_hex = .{55 .install_raw_hex = .{
53 .path = "install_raw_hex",56 .path = "install_raw_hex",
54 },57 },
test/standalone/compile_asm/boot.S created+33
...@@ -0,0 +1,33 @@
1 .section ".text.boot"
2
3 .global _start
4
5 _start:
6 mrc p15, #0, r1, c0, c0, #5
7 and r1, r1, #3
8 cmp r1, #0
9 bne halt
10
11 mov sp, #0x8000
12
13 ldr r4, =__bss_start
14 ldr r9, =__bss_end
15 mov r5, #0
16 mov r6, #0
17 mov r7, #0
18 mov r8, #0
19 b 2f
20
21 1:
22 stmia r4!, {r5-r8}
23
24 2:
25 cmp r4, r9
26 blo 1b
27
28 ldr r3, =main
29 blx r3
30
31 halt:
32 wfe
33 b halt
test/standalone/compile_asm/build.zig created+29
...@@ -0,0 +1,29 @@
1const std = @import("std");
2
3pub fn build(b: *std.Build) !void {
4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;
6
7 const optimize: std.builtin.OptimizeMode = .Debug;
8 const target = b.resolveTargetQuery(.{
9 .os_tag = .freestanding,
10 .cpu_arch = .arm,
11 .cpu_model = .{
12 .explicit = &std.Target.arm.cpu.arm1176jz_s,
13 },
14 });
15
16 const kernel = b.addExecutable(.{
17 .name = "kernel",
18 .root_module = b.createModule(.{
19 .root_source_file = b.path("./main.zig"),
20 .optimize = optimize,
21 .target = target,
22 }),
23 });
24 kernel.root_module.addObjectFile(b.path("./boot.S"));
25 kernel.setLinkerScript(b.path("./linker.ld"));
26 b.installArtifact(kernel);
27
28 test_step.dependOn(&kernel.step);
29}
test/standalone/compile_asm/linker.ld created+42
...@@ -0,0 +1,42 @@
1ENTRY(_start)
2
3SECTIONS
4{
5 /* Starts at LOADER_ADDR. */
6 . = 0x8000;
7 __start = .;
8 __text_start = .;
9 .text :
10 {
11 KEEP(*(.text.boot))
12 *(.text)
13 }
14 . = ALIGN(4096); /* align to page size */
15 __text_end = .;
16
17 __rodata_start = .;
18 .rodata :
19 {
20 *(.rodata)
21 }
22 . = ALIGN(4096); /* align to page size */
23 __rodata_end = .;
24
25 __data_start = .;
26 .data :
27 {
28 *(.data)
29 }
30 . = ALIGN(4096); /* align to page size */
31 __data_end = .;
32
33 __bss_start = .;
34 .bss :
35 {
36 bss = .;
37 *(.bss)
38 }
39 . = ALIGN(4096); /* align to page size */
40 __bss_end = .;
41 __end = .;
42}
test/standalone/compile_asm/main.zig created+11
...@@ -0,0 +1,11 @@
1export fn main(r0: u32, r1: u32, atags: u32) callconv(.c) noreturn {
2 _ = r0;
3 _ = r1;
4 _ = atags;
5 unreachable; // never gets run so it doesn't matter
6}
7pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace, _: ?usize) noreturn {
8 _ = msg;
9 _ = error_return_trace;
10 while (true) {}
11}
test/standalone/glibc_compat/build.zig created+262
...@@ -0,0 +1,262 @@
1const std = @import("std");
2const builtin = @import("builtin");
3
4// To run executables linked against a specific glibc version, the
5// run-time glibc version needs to be new enough. Check the host's glibc
6// version. Note that this does not allow for translation/vm/emulation
7// services to run these tests.
8const running_glibc_ver = builtin.os.versionRange().gnuLibCVersion();
9
10pub fn build(b: *std.Build) void {
11 const test_step = b.step("test", "Test");
12 b.default_step = test_step;
13
14 for ([_][]const u8{ "aarch64-linux-gnu.2.27", "aarch64-linux-gnu.2.34" }) |t| {
15 const exe = b.addExecutable(.{
16 .name = t,
17 .root_module = b.createModule(.{
18 .root_source_file = null,
19 .target = b.resolveTargetQuery(std.Target.Query.parse(
20 .{ .arch_os_abi = t },
21 ) catch unreachable),
22 .link_libc = true,
23 }),
24 });
25 // We disable UBSAN for these tests as the libc being tested here is
26 // so old, it doesn't even support compiling our UBSAN implementation.
27 exe.bundle_ubsan_rt = false;
28 exe.root_module.sanitize_c = .off;
29 exe.root_module.addCSourceFile(.{ .file = b.path("main.c") });
30 // TODO: actually test the output
31 _ = exe.getEmittedBin();
32 test_step.dependOn(&exe.step);
33 }
34
35 // Build & run a C test case against a sampling of supported glibc versions
36 versions: for ([_][]const u8{
37 // "native-linux-gnu.2.0", // fails with a pile of missing symbols.
38 "native-linux-gnu.2.2.5",
39 "native-linux-gnu.2.4",
40 "native-linux-gnu.2.12",
41 "native-linux-gnu.2.16",
42 "native-linux-gnu.2.22",
43 "native-linux-gnu.2.28",
44 "native-linux-gnu.2.33",
45 "native-linux-gnu.2.38",
46 "native-linux-gnu",
47 }) |t| {
48 const target = b.resolveTargetQuery(std.Target.Query.parse(
49 .{ .arch_os_abi = t },
50 ) catch unreachable);
51
52 const glibc_ver = target.result.os.version_range.linux.glibc;
53
54 // only build test if glibc version supports the architecture
55 for (std.zig.target.available_libcs) |libc| {
56 if (libc.arch != target.result.cpu.arch or
57 libc.os != target.result.os.tag or
58 libc.abi != target.result.abi)
59 continue;
60
61 if (libc.glibc_min) |min| {
62 if (glibc_ver.order(min) == .lt) continue :versions;
63 }
64 }
65
66 const exe = b.addExecutable(.{
67 .name = t,
68 .root_module = b.createModule(.{
69 .root_source_file = null,
70 .target = target,
71 .link_libc = true,
72 }),
73 });
74 // We disable UBSAN for these tests as the libc being tested here is
75 // so old, it doesn't even support compiling our UBSAN implementation.
76 exe.bundle_ubsan_rt = false;
77 exe.root_module.sanitize_c = .off;
78 exe.root_module.addCSourceFile(.{ .file = b.path("glibc_runtime_check.c") });
79
80 // Only try running the test if the host glibc is known to be good enough. Ideally, the Zig
81 // test runner would be able to check this, but see https://github.com/ziglang/zig/pull/17702#issuecomment-1831310453
82 if (running_glibc_ver) |running_ver| {
83 if (glibc_ver.order(running_ver) == .lt) {
84 const run_cmd = b.addRunArtifact(exe);
85 run_cmd.skip_foreign_checks = true;
86 run_cmd.expectExitCode(0);
87
88 test_step.dependOn(&run_cmd.step);
89 }
90 }
91 const check = exe.checkObject();
92
93 // __errno_location is always a dynamically linked symbol
94 check.checkInDynamicSymtab();
95 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __errno_location");
96
97 // before v2.32 fstat redirects through __fxstat, afterwards its a
98 // normal dynamic symbol
99 check.checkInDynamicSymtab();
100 if (glibc_ver.order(.{ .major = 2, .minor = 32, .patch = 0 }) == .lt) {
101 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __fxstat");
102
103 check.checkInSymtab();
104 check.checkContains("FUNC LOCAL HIDDEN fstat");
105 } else {
106 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT fstat");
107
108 check.checkInSymtab();
109 check.checkNotPresent("__fxstat");
110 }
111
112 // before v2.26 reallocarray is not supported
113 check.checkInDynamicSymtab();
114 if (glibc_ver.order(.{ .major = 2, .minor = 26, .patch = 0 }) == .lt) {
115 check.checkNotPresent("reallocarray");
116 } else {
117 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT reallocarray");
118 }
119
120 // before v2.38 strlcpy is not supported
121 check.checkInDynamicSymtab();
122 if (glibc_ver.order(.{ .major = 2, .minor = 38, .patch = 0 }) == .lt) {
123 check.checkNotPresent("strlcpy");
124 } else {
125 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT strlcpy");
126 }
127
128 // v2.16 introduced getauxval()
129 check.checkInDynamicSymtab();
130 if (glibc_ver.order(.{ .major = 2, .minor = 16, .patch = 0 }) == .lt) {
131 check.checkNotPresent("getauxval");
132 } else {
133 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT getauxval");
134 }
135
136 // Always have dynamic "exit", "pow", and "powf" references
137 check.checkInDynamicSymtab();
138 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT exit");
139 check.checkInDynamicSymtab();
140 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT pow");
141 check.checkInDynamicSymtab();
142 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT powf");
143
144 // An atexit local symbol is defined, and depends on undefined dynamic
145 // __cxa_atexit.
146 check.checkInSymtab();
147 check.checkContains("FUNC LOCAL HIDDEN atexit");
148 check.checkInDynamicSymtab();
149 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __cxa_atexit");
150
151 test_step.dependOn(&check.step);
152 }
153
154 // Build & run a Zig test case against a sampling of supported glibc versions
155 versions: for ([_][]const u8{
156 "native-linux-gnu.2.17", // Currently oldest supported, see #17769
157 "native-linux-gnu.2.23",
158 "native-linux-gnu.2.28",
159 "native-linux-gnu.2.33",
160 "native-linux-gnu.2.38",
161 "native-linux-gnu",
162 }) |t| {
163 const target = b.resolveTargetQuery(std.Target.Query.parse(
164 .{ .arch_os_abi = t },
165 ) catch unreachable);
166
167 const glibc_ver = target.result.os.version_range.linux.glibc;
168
169 // only build test if glibc version supports the architecture
170 for (std.zig.target.available_libcs) |libc| {
171 if (libc.arch != target.result.cpu.arch or
172 libc.os != target.result.os.tag or
173 libc.abi != target.result.abi)
174 continue;
175
176 if (libc.glibc_min) |min| {
177 if (glibc_ver.order(min) == .lt) continue :versions;
178 }
179 }
180
181 const exe = b.addExecutable(.{
182 .name = t,
183 .root_module = b.createModule(.{
184 .root_source_file = b.path("glibc_runtime_check.zig"),
185 .target = target,
186 .link_libc = true,
187 }),
188 });
189 // We disable UBSAN for these tests as the libc being tested here is
190 // so old, it doesn't even support compiling our UBSAN implementation.
191 exe.bundle_ubsan_rt = false;
192 exe.root_module.sanitize_c = .off;
193
194 // Only try running the test if the host glibc is known to be good enough. Ideally, the Zig
195 // test runner would be able to check this, but see https://github.com/ziglang/zig/pull/17702#issuecomment-1831310453
196 if (running_glibc_ver) |running_ver| {
197 if (glibc_ver.order(running_ver) == .lt) {
198 const run_cmd = b.addRunArtifact(exe);
199 run_cmd.skip_foreign_checks = true;
200 run_cmd.expectExitCode(0);
201
202 test_step.dependOn(&run_cmd.step);
203 }
204 }
205 const check = exe.checkObject();
206
207 // __errno_location is always a dynamically linked symbol
208 check.checkInDynamicSymtab();
209 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __errno_location");
210
211 // before v2.32 fstatat redirects through __fxstatat, afterwards its a
212 // normal dynamic symbol
213 if (glibc_ver.order(.{ .major = 2, .minor = 32, .patch = 0 }) == .lt) {
214 check.checkInDynamicSymtab();
215 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __fxstatat");
216
217 check.checkInSymtab();
218 check.checkContains("FUNC LOCAL HIDDEN fstatat");
219 } else {
220 check.checkInDynamicSymtab();
221 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT fstatat");
222
223 check.checkInSymtab();
224 check.checkNotPresent("FUNC LOCAL HIDDEN fstatat");
225 }
226
227 // before v2.26 reallocarray is not supported
228 if (glibc_ver.order(.{ .major = 2, .minor = 26, .patch = 0 }) == .lt) {
229 check.checkInDynamicSymtab();
230 check.checkNotPresent("reallocarray");
231 } else {
232 check.checkInDynamicSymtab();
233 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT reallocarray");
234 }
235
236 // before v2.38 strlcpy is not supported
237 if (glibc_ver.order(.{ .major = 2, .minor = 38, .patch = 0 }) == .lt) {
238 check.checkInDynamicSymtab();
239 check.checkNotPresent("strlcpy");
240 } else {
241 check.checkInDynamicSymtab();
242 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT strlcpy");
243 }
244
245 // v2.16 introduced getauxval(), so always present
246 check.checkInDynamicSymtab();
247 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT getauxval");
248
249 // Always have a dynamic "exit" reference
250 check.checkInDynamicSymtab();
251 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT exit");
252
253 // An atexit local symbol is defined, and depends on undefined dynamic
254 // __cxa_atexit.
255 check.checkInSymtab();
256 check.checkContains("FUNC LOCAL HIDDEN atexit");
257 check.checkInDynamicSymtab();
258 check.checkExact("0 0 UND FUNC GLOBAL DEFAULT __cxa_atexit");
259
260 test_step.dependOn(&check.step);
261 }
262}
test/standalone/glibc_compat/glibc_runtime_check.c created+114
...@@ -0,0 +1,114 @@
1/*
2 * Exercise complicating glibc symbols from C code. Complicating symbols
3 * are ones that have moved between glibc versions, or use floating point
4 * parameters, or have otherwise tripped up the Zig glibc compatibility
5 * code.
6 */
7#include <assert.h>
8#include <errno.h>
9#include <features.h>
10#include <fcntl.h>
11#include <math.h>
12#include <stdio.h>
13#include <stdlib.h>
14#include <string.h>
15#include <sys/auxv.h>
16#include <sys/stat.h>
17#include <unistd.h>
18
19/* errno is compilcated (thread-local, dynamically provided, etc). */
20static void check_errno()
21{
22 int invalid_fd = open("/doesnotexist", O_RDONLY);
23 assert(invalid_fd == -1);
24 assert(errno == ENOENT);
25}
26
27/* fstat has moved around in glibc (between libc_nonshared and libc) */
28static void check_fstat()
29{
30 int self_fd = open("/proc/self/exe", O_RDONLY);
31
32 struct stat statbuf = {0};
33 int rc = fstat(self_fd, &statbuf);
34
35 assert(rc == 0);
36
37 assert(statbuf.st_dev != 0);
38 assert(statbuf.st_ino != 0);
39 assert(statbuf.st_mode != 0);
40 assert(statbuf.st_size > 0);
41 assert(statbuf.st_blocks > 0);
42 assert(statbuf.st_ctim.tv_sec > 0);
43
44 close(self_fd);
45}
46
47/* Some targets have a complicated ABI for floats and doubles */
48static void check_fp_abi()
49{
50 // Picked "pow" as it takes and returns doubles
51 assert(pow(10.0, 10.0) == 10000000000.0);
52 assert(powf(10.0f, 10.0f) == 10000000000.0f);
53}
54
55/* strlcpy introduced in glibc 2.38 */
56static void check_strlcpy()
57{
58#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || (__GLIBC__ > 2)
59 char target[4] = {0};
60 strlcpy(target, "this is a source string", 4);
61
62 assert(strcmp(target, "thi") == 0);
63#endif
64}
65
66/* reallocarray introduced in glibc 2.26 */
67static void check_reallocarray()
68{
69#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 26) || (__GLIBC__ > 2)
70 const size_t el_size = 32;
71 void* base = reallocarray(NULL, 10, el_size);
72 void* grown = reallocarray(base, 100, el_size);
73
74 assert(base != NULL);
75 assert(grown != NULL);
76
77 free(grown);
78#endif
79}
80
81/* getauxval introduced in glibc 2.16 */
82static void check_getauxval()
83{
84#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16) || (__GLIBC__ > 2)
85 int pgsz = getauxval(AT_PAGESZ);
86 assert(pgsz >= 4*1024);
87#endif
88}
89
90/* atexit() is part of libc_nonshared */
91static void force_exit_0()
92{
93 exit(0);
94}
95
96static void check_atexit()
97{
98 int rc = atexit(force_exit_0);
99 assert(rc == 0);
100}
101
102int main() {
103 int rc;
104
105 check_errno();
106 check_fstat();
107 check_fp_abi();
108 check_strlcpy();
109 check_reallocarray();
110 check_getauxval();
111 check_atexit();
112
113 exit(99); // exit code overridden by atexit handler
114}
test/standalone/glibc_compat/glibc_runtime_check.zig created+116
...@@ -0,0 +1,116 @@
1// A zig test case that exercises some glibc symbols that have uncovered
2// problems in the past. This test must be compiled against a glibc.
3//
4// The build.zig tests the binary built from this source to see that
5// symbols are statically or dynamically linked, as expected.
6
7const std = @import("std");
8const builtin = @import("builtin");
9const assert = std.debug.assert;
10
11const c_malloc = @cImport(
12 @cInclude("malloc.h"), // for reallocarray
13);
14
15const c_stdlib = @cImport(
16 @cInclude("stdlib.h"), // for atexit
17);
18
19const c_string = @cImport(
20 @cInclude("string.h"), // for strlcpy
21);
22
23// Version of glibc this test is being built to run against
24const glibc_ver = builtin.os.versionRange().gnuLibCVersion().?;
25
26// PR #17034 - fstat moved between libc_nonshared and libc
27fn checkStat() !void {
28 const cwdFd = std.fs.cwd().fd;
29
30 var stat = std.mem.zeroes(std.c.Stat);
31 var result = std.c.fstatat(cwdFd, "a_file_that_definitely_does_not_exist", &stat, 0);
32 assert(result == -1);
33 assert(std.posix.errno(result) == .NOENT);
34
35 result = std.c.stat("a_file_that_definitely_does_not_exist", &stat);
36 assert(result == -1);
37 assert(std.posix.errno(result) == .NOENT);
38}
39
40// PR #17607 - reallocarray not visible in headers
41fn checkReallocarray() !void {
42 // reallocarray was introduced in v2.26
43 if (comptime glibc_ver.order(.{ .major = 2, .minor = 26, .patch = 0 }) == .lt) {
44 if (@hasDecl(c_malloc, "reallocarray")) {
45 @compileError("Before v2.26 'malloc.h' does not define 'reallocarray'");
46 }
47 } else {
48 return try checkReallocarray_v2_26();
49 }
50}
51
52fn checkReallocarray_v2_26() !void {
53 const size = 16;
54 const tenX = c_malloc.reallocarray(c_malloc.NULL, 10, size);
55 const elevenX = c_malloc.reallocarray(tenX, 11, size);
56
57 assert(tenX != c_malloc.NULL);
58 assert(elevenX != c_malloc.NULL);
59}
60
61// getauxval introduced in v2.16
62fn checkGetAuxVal() !void {
63 if (comptime glibc_ver.order(.{ .major = 2, .minor = 16, .patch = 0 }) == .lt) {
64 if (@hasDecl(std.c, "getauxval")) {
65 @compileError("Before v2.16 glibc does not define 'getauxval'");
66 }
67 } else {
68 try checkGetAuxVal_v2_16();
69 }
70}
71
72fn checkGetAuxVal_v2_16() !void {
73 const base = std.c.getauxval(std.elf.AT_BASE);
74 const pgsz = std.c.getauxval(std.elf.AT_PAGESZ);
75
76 assert(base != 0);
77 assert(pgsz != 0);
78}
79
80// strlcpy introduced in v2.38, which is newer than many installed glibcs
81fn checkStrlcpy() !void {
82 if (comptime glibc_ver.order(.{ .major = 2, .minor = 38, .patch = 0 }) == .lt) {
83 if (@hasDecl(c_string, "strlcpy")) {
84 @compileError("Before v2.38 glibc does not define 'strlcpy'");
85 }
86 } else {
87 try checkStrlcpy_v2_38();
88 }
89}
90
91fn checkStrlcpy_v2_38() !void {
92 var buf: [99]u8 = undefined;
93 const used = c_string.strlcpy(&buf, "strlcpy works!", buf.len);
94 assert(used == 14);
95}
96
97// atexit is part of libc_nonshared, so ensure its linked in correctly
98fn forceExit0Callback() callconv(.c) void {
99 std.c.exit(0); // Override the main() exit code
100}
101
102fn checkAtExit() !void {
103 const result = c_stdlib.atexit(forceExit0Callback);
104 assert(result == 0);
105}
106
107pub fn main() !u8 {
108 try checkStat();
109 try checkReallocarray();
110 try checkStrlcpy();
111
112 try checkGetAuxVal();
113 try checkAtExit();
114
115 std.c.exit(1); // overridden by atexit() callback
116}
test/standalone/glibc_compat/main.c created+40
...@@ -0,0 +1,40 @@
1#define _FILE_OFFSET_BITS 64
2#include <unistd.h>
3#include <fcntl.h>
4#include <stdio.h>
5#include <resolv.h>
6
7int main() {
8 /* in glibc 2.28+ and _FILE_OFFSET_BITS=64 fcntl is #define'd to fcntl64
9 * Thus headers say `fcntl64` exists, but libc.so.6 (the old one)
10 * disagrees, resulting in a linking error unless headers are made
11 * backwards-compatible.
12 *
13 * Glibc 2.28+:
14 * FUNC GLOBAL DEFAULT UND fcntl64@GLIBC_2.28 (3):
15 *
16 * Glibc 2.27 or older:
17 * FUNC GLOBAL DEFAULT UND fcntl@GLIBC_2.2.5
18 */
19 printf("address to fcntl: %p\n", fcntl);
20
21 /* The following functions became symbols of their own right with glibc
22 * 2.34+. Before 2.34 resolv.h would #define res_search __res_search; and
23 * __res_search is a valid symbol since the beginning of time.
24 *
25 * On glibc 2.34+ these symbols are linked this way:
26 * FUNC GLOBAL DEFAULT UND res_search@GLIBC_2.34 (2)
27 *
28 * Pre-glibc 2.34:
29 * FUNC GLOBAL DEFAULT UND __res_search@GLIBC_2.2.5 (4)
30 */
31 printf("address to res_search: %p\n", res_search);
32 printf("address to res_nsearch: %p\n", res_nsearch);
33 printf("address to res_query: %p\n", res_query);
34 printf("address to res_nquery: %p\n", res_nquery);
35 printf("address to res_querydomain: %p\n", res_querydomain);
36 printf("address to res_nquerydomain: %p\n", res_nquerydomain);
37 printf("address to dn_skipname: %p\n", dn_skipname);
38 printf("address to dn_comp: %p\n", dn_comp);
39 printf("address to dn_expand: %p\n", dn_expand);
40}
test/standalone/issue_8550/boot.S deleted-33
...@@ -1,33 +0,0 @@
1 .section ".text.boot"
2
3 .global _start
4
5 _start:
6 mrc p15, #0, r1, c0, c0, #5
7 and r1, r1, #3
8 cmp r1, #0
9 bne halt
10
11 mov sp, #0x8000
12
13 ldr r4, =__bss_start
14 ldr r9, =__bss_end
15 mov r5, #0
16 mov r6, #0
17 mov r7, #0
18 mov r8, #0
19 b 2f
20
21 1:
22 stmia r4!, {r5-r8}
23
24 2:
25 cmp r4, r9
26 blo 1b
27
28 ldr r3, =main
29 blx r3
30
31 halt:
32 wfe
33 b halt
test/standalone/issue_8550/build.zig deleted-29
...@@ -1,29 +0,0 @@
1const std = @import("std");
2
3pub fn build(b: *std.Build) !void {
4 const test_step = b.step("test", "Test it");
5 b.default_step = test_step;
6
7 const optimize: std.builtin.OptimizeMode = .Debug;
8 const target = b.resolveTargetQuery(.{
9 .os_tag = .freestanding,
10 .cpu_arch = .arm,
11 .cpu_model = .{
12 .explicit = &std.Target.arm.cpu.arm1176jz_s,
13 },
14 });
15
16 const kernel = b.addExecutable(.{
17 .name = "kernel",
18 .root_module = b.createModule(.{
19 .root_source_file = b.path("./main.zig"),
20 .optimize = optimize,
21 .target = target,
22 }),
23 });
24 kernel.root_module.addObjectFile(b.path("./boot.S"));
25 kernel.setLinkerScript(b.path("./linker.ld"));
26 b.installArtifact(kernel);
27
28 test_step.dependOn(&kernel.step);
29}
test/standalone/issue_8550/linker.ld deleted-42
...@@ -1,42 +0,0 @@
1ENTRY(_start)
2
3SECTIONS
4{
5 /* Starts at LOADER_ADDR. */
6 . = 0x8000;
7 __start = .;
8 __text_start = .;
9 .text :
10 {
11 KEEP(*(.text.boot))
12 *(.text)
13 }
14 . = ALIGN(4096); /* align to page size */
15 __text_end = .;
16
17 __rodata_start = .;
18 .rodata :
19 {
20 *(.rodata)
21 }
22 . = ALIGN(4096); /* align to page size */
23 __rodata_end = .;
24
25 __data_start = .;
26 .data :
27 {
28 *(.data)
29 }
30 . = ALIGN(4096); /* align to page size */
31 __data_end = .;
32
33 __bss_start = .;
34 .bss :
35 {
36 bss = .;
37 *(.bss)
38 }
39 . = ALIGN(4096); /* align to page size */
40 __bss_end = .;
41 __end = .;
42}
test/standalone/issue_8550/main.zig deleted-11
...@@ -1,11 +0,0 @@
1export fn main(r0: u32, r1: u32, atags: u32) callconv(.c) noreturn {
2 _ = r0;
3 _ = r1;
4 _ = atags;
5 unreachable; // never gets run so it doesn't matter
6}
7pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace, _: ?usize) noreturn {
8 _ = msg;
9 _ = error_return_trace;
10 while (true) {}
11}
test/tests.zig-37
...@@ -6,9 +6,7 @@ const OptimizeMode = std.builtin.OptimizeMode;...@@ -6,9 +6,7 @@ const OptimizeMode = std.builtin.OptimizeMode;
6const Step = std.Build.Step;6const Step = std.Build.Step;
77
8// Cases8// Cases
9const compare_output = @import("compare_output.zig");
10const stack_traces = @import("stack_traces.zig");9const stack_traces = @import("stack_traces.zig");
11const assemble_and_link = @import("assemble_and_link.zig");
12const translate_c = @import("translate_c.zig");10const translate_c = @import("translate_c.zig");
13const run_translated_c = @import("run_translated_c.zig");11const run_translated_c = @import("run_translated_c.zig");
14const llvm_ir = @import("llvm_ir.zig");12const llvm_ir = @import("llvm_ir.zig");
...@@ -16,7 +14,6 @@ const llvm_ir = @import("llvm_ir.zig");...@@ -16,7 +14,6 @@ const llvm_ir = @import("llvm_ir.zig");
16// Implementations14// Implementations
17pub const TranslateCContext = @import("src/TranslateC.zig");15pub const TranslateCContext = @import("src/TranslateC.zig");
18pub const RunTranslatedCContext = @import("src/RunTranslatedC.zig");16pub const RunTranslatedCContext = @import("src/RunTranslatedC.zig");
19pub const CompareOutputContext = @import("src/CompareOutput.zig");
20pub const StackTracesContext = @import("src/StackTrace.zig");17pub const StackTracesContext = @import("src/StackTrace.zig");
21pub const DebuggerContext = @import("src/Debugger.zig");18pub const DebuggerContext = @import("src/Debugger.zig");
22pub const LlvmIrContext = @import("src/LlvmIr.zig");19pub const LlvmIrContext = @import("src/LlvmIr.zig");
...@@ -1863,25 +1860,6 @@ const c_abi_targets = blk: {...@@ -1863,25 +1860,6 @@ const c_abi_targets = blk: {
1863 };1860 };
1864};1861};
18651862
1866pub fn addCompareOutputTests(
1867 b: *std.Build,
1868 test_filters: []const []const u8,
1869 optimize_modes: []const OptimizeMode,
1870) *Step {
1871 const cases = b.allocator.create(CompareOutputContext) catch @panic("OOM");
1872 cases.* = CompareOutputContext{
1873 .b = b,
1874 .step = b.step("test-compare-output", "Run the compare output tests"),
1875 .test_index = 0,
1876 .test_filters = test_filters,
1877 .optimize_modes = optimize_modes,
1878 };
1879
1880 compare_output.addCases(cases);
1881
1882 return cases.step;
1883}
1884
1885pub fn addStackTraceTests(1863pub fn addStackTraceTests(
1886 b: *std.Build,1864 b: *std.Build,
1887 test_filters: []const []const u8,1865 test_filters: []const []const u8,
...@@ -2175,21 +2153,6 @@ pub fn addCliTests(b: *std.Build) *Step {...@@ -2175,21 +2153,6 @@ pub fn addCliTests(b: *std.Build) *Step {
2175 return step;2153 return step;
2176}2154}
21772155
2178pub fn addAssembleAndLinkTests(b: *std.Build, test_filters: []const []const u8, optimize_modes: []const OptimizeMode) *Step {
2179 const cases = b.allocator.create(CompareOutputContext) catch @panic("OOM");
2180 cases.* = CompareOutputContext{
2181 .b = b,
2182 .step = b.step("test-asm-link", "Run the assemble and link tests"),
2183 .test_index = 0,
2184 .test_filters = test_filters,
2185 .optimize_modes = optimize_modes,
2186 };
2187
2188 assemble_and_link.addCases(cases);
2189
2190 return cases.step;
2191}
2192
2193pub fn addTranslateCTests(2156pub fn addTranslateCTests(
2194 b: *std.Build,2157 b: *std.Build,
2195 parent_step: *std.Build.Step,2158 parent_step: *std.Build.Step,