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 {
9191 const skip_single_threaded = b.option(bool, "skip-single-threaded", "Main test suite skips tests that are single-threaded") orelse false;
9292 const skip_compile_errors = b.option(bool, "skip-compile-errors", "Main test suite skips compile error tests") orelse false;
9393 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;
9595 const skip_freebsd = b.option(bool, "skip-freebsd", "Main test suite skips targets with freebsd OS") orelse false;
9696 const skip_netbsd = b.option(bool, "skip-netbsd", "Main test suite skips targets with netbsd OS") orelse false;
9797 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 {
464464 .max_rss = 4000000000,
465465 }));
466466
467 test_modules_step.dependOn(tests.addModuleTests(b, .{
468 .test_filters = test_filters,
469 .test_target_filters = test_target_filters,
470 .test_extra_targets = test_extra_targets,
471 .root_src = "test/c_import.zig",
472 .name = "c-import",
473 .desc = "Run the @cImport tests",
474 .optimize_modes = optimization_modes,
475 .include_paths = &.{"test/c_import"},
476 .skip_single_threaded = true,
477 .skip_non_native = skip_non_native,
478 .skip_freebsd = skip_freebsd,
479 .skip_netbsd = skip_netbsd,
480 .skip_windows = skip_windows,
481 .skip_macos = skip_macos,
482 .skip_linux = skip_linux,
483 .skip_llvm = skip_llvm,
484 .skip_libc = skip_libc,
485 }));
467 if (!skip_translate_c) {
468 test_modules_step.dependOn(tests.addModuleTests(b, .{
469 .test_filters = test_filters,
470 .test_target_filters = test_target_filters,
471 .test_extra_targets = test_extra_targets,
472 .root_src = "test/c_import.zig",
473 .name = "c-import",
474 .desc = "Run the @cImport tests",
475 .optimize_modes = optimization_modes,
476 .include_paths = &.{"test/c_import"},
477 .skip_single_threaded = true,
478 .skip_non_native = skip_non_native,
479 .skip_freebsd = skip_freebsd,
480 .skip_netbsd = skip_netbsd,
481 .skip_windows = skip_windows,
482 .skip_macos = skip_macos,
483 .skip_linux = skip_linux,
484 .skip_llvm = skip_llvm,
485 .skip_libc = skip_libc,
486 }));
487 }
486488
487489 test_modules_step.dependOn(tests.addModuleTests(b, .{
488490 .test_filters = test_filters,
......@@ -568,7 +570,6 @@ pub fn build(b: *std.Build) !void {
568570 unit_tests.root_module.addOptions("build_options", exe_options);
569571 unit_tests_step.dependOn(&b.addRunArtifact(unit_tests).step);
570572
571 test_step.dependOn(tests.addCompareOutputTests(b, test_filters, optimization_modes));
572573 test_step.dependOn(tests.addStandaloneTests(
573574 b,
574575 optimization_modes,
......@@ -590,7 +591,6 @@ pub fn build(b: *std.Build) !void {
590591 test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));
591592 test_step.dependOn(tests.addStackTraceTests(b, test_filters, optimization_modes));
592593 test_step.dependOn(tests.addCliTests(b));
593 test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filters, optimization_modes));
594594 if (tests.addDebuggerTests(b, .{
595595 .test_filters = test_filters,
596596 .test_target_filters = test_target_filters,
ci/riscv64-linux-debug.sh+1-1
......@@ -49,7 +49,7 @@ unset CXX
4949ninja install
5050
5151# 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 \
5353 --maxrss 68719476736 \
5454 -Dstatic-llvm \
5555 -Dskip-non-native \
ci/riscv64-linux-release.sh+1-1
......@@ -49,7 +49,7 @@ unset CXX
4949ninja install
5050
5151# 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 \
5353 --maxrss 68719476736 \
5454 -Dstatic-llvm \
5555 -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.
7777
7878```zig
7979// run
80// backend=stage2,llvm
80// backend=selfhosted,llvm
8181// target=x86_64-linux,x86_64-macos
8282```
8383
8484Possible backends are:
8585
86 * `stage1`: equivalent to `-fstage1`.
87 * `stage2`: equivalent to passing `-fno-stage1 -fno-LLVM`.
88 * `llvm`: equivalent to `-fLLVM -fno-stage1`.
86 * `auto`: the default; compiler picks the backend based on robustness.
87 * `selfhosted`: equivalent to passing `-fno-llvm -fno-lld`.
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;
66
77// compile
88// output_mode=Obj
9// backend=stage2,llvm
9// backend=selfhosted,llvm
1010// 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 {
1818}
1919
2020// run
21// backend=stage2,llvm
21// backend=selfhosted,llvm
2222// 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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
2020}
2121
2222// error
23// backend=stage2
2423// target=x86_64-linux
2524//
2625// :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 {
77// https://github.com/ziglang/zig/issues/13782
88
99// error
10// backend=stage2
1110// target=x86_64-linux
1211//
1312// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :8:12: error: variable of type 'tmp.S1' must be const or comptime
1715// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :3:19: error: C pointers cannot point to non-C-ABI-compatible type 'tmp.Foo'
1311// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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) {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :3:12: error: negation of type 'u32'
1513// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :9:15: error: access of union field 'a' while field 'b' is active
2220// :2:21: note: union declared here
test/cases/compile_errors/access_non-existent_member_of_error_set.zig-2
......@@ -5,7 +5,5 @@ comptime {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :4:24: error: 'y' not accessible from inner function
2018// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :6:5: error: found compile log statement
2220//
test/cases/compile_errors/add_wrap_on_undefined_value.zig-2
......@@ -15,8 +15,6 @@ comptime {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :6:5: error: found compile log statement
2220//
test/cases/compile_errors/addition_with_non_numbers.zig-2
......@@ -8,7 +8,5 @@ export fn entry() usize {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :4:12: error: expected type '*const i32', found '*const comptime_int'
1513// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
33}
44
55// error
6// backend=stage2
76// target=wasm32-freestanding-none
87//
98// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :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 {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :2:25: error: ambiguous coercion of division operands 'comptime_float' and 'comptime_int'; non-zero remainder '4'
2321// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :5:13: error: ambiguous reference
2018// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:9: error: expected type '?*anyopaque', found '?usize'
119// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :3:8: error: type 'bool' does not support indexing
1513// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:14: error: type 'type' does not support indexing
119// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :4:11: error: expected type 'usize', found 'bool'
1917// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
3232}
3333
3434// error
35// backend=stage2
36// target=native
3735//
3836// :4:17: error: expected 8 vector elements; found 1
3937// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :6:5: error: unable to evaluate comptime expression
1816// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
55inline fn b() void {}
66
77// error
8// backend=stage2
9// target=native
108//
119// :2:9: error: variable of type '*const fn () callconv(.@"inline") void' must be const or comptime
1210// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :6:21: error: expected type 'u32', found 'u64'
2018// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:5: error: unreachable code
119// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :11:20: error: expected type 'u8', found '?u8'
2220// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
2121}
2222
2323// error
24// backend=stage2
25// target=native
2624//
2725// :3:22: error: expected bool, integer, enum, packed struct, or pointer type; found 'f32'
2826// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :4:19: error: mutable 'T' not accessible from here
1311// :2:9: note: declared mutable here
test/cases/compile_errors/attempt_to_create_17_bit_float_type.zig-2
......@@ -4,7 +4,5 @@ comptime {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :2:28: error: expected type '*const [0]u32', found '*u32'
1614// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :4:22: error: expected type '*[1]i32', found '*const i32'
1412// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :3:22: error: expected type '[]u32', found '*const u32'
1210// :3:22: note: cast discards const qualifier
test/cases/compile_errors/bad_alignCast_at_comptime.zig-2
......@@ -5,7 +5,5 @@ comptime {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :3:31: error: expected type '[]align(16) u8', found '*[10]u8'
1210// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :2:22: error: expected type 'u29', found 'bool'
1513// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
3636noinline fn dummy2() void {}
3737
3838// error
39// backend=stage2
40// target=native
4139//
4240// :2:23: error: expected a tuple, found 'void'
4341// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :3:18: error: cannot @bitCast to 'tmp.entry.E'
1210// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :1:29: error: root source file struct 'builtin' has no member named 'bogus'
119// note: struct declared here
test/cases/compile_errors/bool_not_on_vector_of_ints.zig-2
......@@ -4,7 +4,5 @@ export fn foo() void {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
2424}
2525
2626// error
27// backend=stage2
28// target=native
2927//
3028// :2:22: error: expected type 'usize', found 'void'
3129// :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 {
55fn boolFunction(_: bool) void {}
66
77// error
8// backend=stage2
9// target=native
108//
119// :2:43: error: expected type 'bool', found 'void'
1210// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:18: error: C pointers cannot point to non-C-ABI-compatible type 'void'
119// :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 {
1717}
1818
1919// error
20// backend=stage2
21// target=native
2220//
2321// :12:5: error: cannot assign to constant
2422// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// 6:10: error: no field or member function named 'b' in '*tmp.S'
1412// 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 {
1717fn f() void {}
1818
1919// error
20// backend=stage2
21// target=native
2220//
2321// :2:6: error: runtime call not allowed in naked function
2422// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :3:9: error: cannot call optional type '?fn () void'
1513// :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;
22export fn foo() callconv(cc) void {}
33
44// error
5// backend=stage2
6// target=native
75//
86// :2:26: error: unable to resolve comptime value
97// :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 {}
33export fn entry3() callconv(.avr_interrupt) void {}
44
55// error
6// backend=stage2
76// target=aarch64-linux-none
87//
98// :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 @@
11export fn entry() callconv(.avr_signal) void {}
22
33// error
4// backend=stage2
54// target=x86_64-linux-none
65//
76// :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 {
1515}
1616
1717// error
18// backend=stage2
1918// target=x86_64-linux-none
2019//
2120// :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 {
44fn foo() callconv(.naked) void {}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:5: error: unable to call function with calling convention 'naked'
119// :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 {
66pub extern fn foo(format: *const u8, ...) void;
77
88// error
9// backend=stage2
10// target=native
119//
1210// :3:16: error: expected type '*const u8', found '[5:0]u8'
1311// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :4:13: error: cannot break out of defer expression
1412// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :4:13: error: cannot continue out of defer expression
1412// :3:9: note: defer expression here
test/cases/compile_errors/capture_by_ref_discard.zig-2
......@@ -17,8 +17,6 @@ export fn d() void {
1717}
1818
1919// error
20// backend=stage2
21// target=native
2220//
2321// :2:16: error: pointer modifier invalid on discard
2422// :7:18: error: pointer modifier invalid on discard
test/cases/compile_errors/capture_by_ref_if.zig-2
......@@ -3,8 +3,6 @@ test {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:22: error: unused capture
108// :2:38: error: unused capture
test/cases/compile_errors/capture_by_ref_if_err_switch.zig-2
......@@ -4,7 +4,5 @@ test {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:14: error: unused capture
test/cases/compile_errors/capture_by_ref_switch.zig-2
......@@ -5,7 +5,5 @@ test {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :3:17: error: unused capture
test/cases/compile_errors/capture_by_ref_while.zig-2
......@@ -3,8 +3,6 @@ test {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:25: error: unused capture
108// :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 {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :6:9: error: expected type '?*const fn (i8) void', found '?*const fn (u64) void'
2321// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :6:21: error: enum 'tmp.Foo' has no member named 'c'
1513// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :3:37: error: expected type 'error{A}!i32', found 'anyerror!i32'
1513// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :3:33: error: expected type 'error{A}', found 'anyerror'
1513// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :2:26: error: type 'usize' cannot represent integer value '-10'
1513// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :3:36: error: type 'u32' cannot represent integer value '-1'
1715// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:12: error: unreachable code
1311// :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 {
1919}
2020
2121// error
22// backend=stage2
23// target=native
2422//
2523// :2:9: error: @ptrFromInt must have a known result type
2624// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :2:34: error: @intCast must have a known result type
1715// :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 {
1919fn bar(_: anytype) void {}
2020
2121// error
22// backend=stage2
23// target=native
2422//
2523// :2:9: error: @ptrFromInt must have a known result type
2624// :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 {
1717}
1818
1919// error
20// backend=stage2
21// target=native
2220//
2321// :8:16: error: expected type '*const u3', found '*align(1:3:1) const u3'
2422// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:22: error: comparison operators cannot be chained
test/cases/compile_errors/cimport.zig-2
......@@ -7,8 +7,6 @@ const d = @cImport({
77});
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :1:11: error: C define valid only inside C import block
1412// :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 {
1818}
1919
2020// error
21// backend=stage2
22// target=native
2321//
2422// :17:25: error: expected type 'u32', found 'type'
2523// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// 2:28: error: expected type 'anyerror!u8', found 'comptime_int'
119// 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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// 2:20: error: expected type '?u8', found 'comptime_int'
119// 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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :6:5: error: found compile log statement
1917// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :2:11: error: use of undeclared identifier 'SymbolThatDoesNotExist'
test/cases/compile_errors/compile_log.zig-2
......@@ -13,8 +13,6 @@ export fn baz() void {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :6:5: error: found compile log statement
2018// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :2:5: error: found compile log statement
1513//
test/cases/compile_errors/compile_log_statement_warning_deduplication_in_generic_fn.zig-2
......@@ -10,8 +10,6 @@ fn inner(comptime n: usize) void {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :8:9: error: found compile log statement
1715// :8:9: note: also here
test/cases/compile_errors/compile_time_null_ptr_cast.zig-2
......@@ -5,7 +5,5 @@ comptime {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :7:28: error: enum 'meta.FieldEnum(tmp.MyStruct)' has no member named 'c'
2119// :?:?: 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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :8:26: error: coercion from enum 'tmp.Letter' to union 'tmp.Value' must initialize 'i32' field 'A'
1715// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :4:21: error: comptime control flow inside runtime block
1614// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :6:22: error: comptime control flow inside runtime block
1614// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :6:20: error: comptime control flow inside runtime block
1614// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :6:20: error: comptime control flow inside runtime block
1614// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :4:22: error: comptime control flow inside runtime block
1614// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :7:19: error: comptime control flow inside runtime block
1917// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :6:25: error: comptime control flow inside runtime block
1614// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :7:13: error: comptime control flow inside runtime block
1816// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :6:23: error: comptime control flow inside runtime block
1614// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :10:30: error: comptime control flow inside runtime block
2220// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :5:21: error: value with comptime-only type 'comptime_int' depends on runtime control flow
1513// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {}
1111fn bar(comptime _: i32, _: i32) void {}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :3:9: error: expected type 'fn (comptime i32, comptime i32) void', found 'fn (comptime i32, i32) void'
1816// :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 {
5555}
5656
5757// error
58// backend=stage2
59// target=native
6058//
6159// :4:29: error: value in memory does not match slice sentinel
6260// :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 {
5555}
5656
5757// error
58// backend=stage2
59// target=native
6058//
6159// :4:29: error: value in memory does not match slice sentinel
6260// :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 {
7070}
7171
7272// error
73// backend=stage2
74// target=native
7573//
7674// :4:29: error: value in memory does not match slice sentinel
7775// :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 {
5555}
5656
5757// error
58// backend=stage2
59// target=native
6058//
6159// :4:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'
6260// :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 {
5555}
5656
5757// error
58// backend=stage2
59// target=native
6058//
6159// :4:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'
6260// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
1818}
1919
2020// error
21// backend=stage2
22// target=native
2321//
2422// :13:25: error: store to comptime variable depends on runtime condition
2523// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
33}
44
55// error
6// target=native
7// backend=stage2
86//
97// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
2929}
3030
3131// error
32// backend=stage2
33// target=native
3432//
3533// :3:24: error: cannot store to comptime variable in non-inline loop
3634// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :3:15: error: declaration 'a' shadows function parameter from outer scope
2119// :1:8: note: previous declaration here
test/cases/compile_errors/declaration_between_fields.zig-2
......@@ -16,8 +16,6 @@ comptime {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :9:5: error: declarations are not allowed between container fields
2321// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :1:7: error: name shadows primitive 'u8'
1210// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:5: error: use of undeclared identifier 'x'
1311// :5:5: error: use of undeclared identifier 'x'
test/cases/compile_errors/deref_on_undefined_value.zig-2
......@@ -4,7 +4,5 @@ comptime {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :5:10: error: cannot dereference non-pointer type '[10]u8'
test/cases/compile_errors/dereference_slice.zig-2
......@@ -6,7 +6,5 @@ comptime {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
2525}
2626
2727// error
28// backend=stage2
29// target=native
3028//
3129// :16:20: error: attempt to use null value
3230// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :4:28: error: type 'anyerror!struct { u8, u8 }' cannot be destructured
1412// :4:26: note: result destructured here
test/cases/compile_errors/direct_struct_loop.zig-2
......@@ -6,7 +6,5 @@ export fn entry() usize {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
2525}
2626
2727// error
28// backend=stage2
29// target=native
3028//
3129// :3:8: error: opaque types have unknown size and therefore cannot be directly embedded in structs
3230// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :5:14: error: expected type '[*:0]const u8', found '[*]const u8'
1311// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :2:12: error: error union is discarded
1715// :2:12: note: consider using 'try', 'catch', or 'if'
test/cases/compile_errors/div_overflow.zig-2
......@@ -5,7 +5,5 @@ comptime {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
2323}
2424
2525// error
26// backend=stage2
27// target=native
2826//
2927// :4:35: error: expected type '*const anyopaque', found '*const *const usize'
3028// :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 {
2929}
3030
3131// error
32// target=native
3332//
3433// :3:9: error: redefinition of label 'blk'
3534// :2:5: note: previous definition here
test/cases/compile_errors/duplicate_boolean_switch_value.zig-2
......@@ -16,8 +16,6 @@ comptime {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :5:9: error: duplicate switch value
2321// :13:9: error: duplicate switch value
test/cases/compile_errors/duplicate_enum_field.zig-2
......@@ -9,8 +9,6 @@ export fn entry() void {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :2:5: error: duplicate enum member name 'Bar'
1614// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :5:9: error: duplicate switch value
2220// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :3:5: error: duplicate error set field 'Bar'
1513// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :4:14: error: duplicate struct field name
1816// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:13: error: duplicate struct field name
108// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :8:10: error: duplicate struct field name
2119// :11:10: note: duplicate name here
test/cases/compile_errors/duplicate_struct_field.zig-2
......@@ -21,8 +21,6 @@ export fn b() void {
2121}
2222
2323// error
24// backend=stage2
25// target=native
2624//
2725// :2:5: error: duplicate struct member name 'Bar'
2826// :3:5: note: duplicate name here
test/cases/compile_errors/embedFile_with_bogus_file.zig-2
......@@ -5,7 +5,5 @@ export fn entry() usize {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
33}
44
55// error
6// target=native
76//
87//: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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:12: error: empty character literal
test/cases/compile_errors/empty_for_loop_body.zig-2
......@@ -3,7 +3,5 @@ export fn a() void {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
44}
55
66// error
7// target=native
8// backend=stage2
97//
108// :3:24: error: int value '100' out of range of non-exhaustive enum 'tmp.entry.E'
119// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :6:31: error: unable to resolve comptime value
1412// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
99const D = 1;
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :6:20: error: enum 'tmp.Foo' has no tag with value '0'
1513// :1:13: note: enum declared here
test/cases/compile_errors/enum_value_already_taken.zig-2
......@@ -11,8 +11,6 @@ export fn entry() void {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :6:9: error: enum tag value 60 already taken
1816// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :3:30: error: fractional component prevents float value '12.34' from coercion to type 'u32'
1513// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :6:31: error: unable to resolve comptime value
1412// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :2:26: error: switch must handle all possibilities
2018// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :8:18: error: expected type '*const fn (i32) void', found '*const fn (bool) void'
1614// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :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 {
2424}
2525
2626// error
27// backend=stage2
2827// target=x86_64-linux
2928//
3029// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:26: error: expected 1 argument, found 2
test/cases/compile_errors/exact division failure.zig -2
......@@ -4,7 +4,5 @@ comptime {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :2:15: error: primitive integer type 'u65536' exceeds maximum bit width of 65535
1513// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :2:15: error: expected optional type, found 'tmp.X'
1614// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :10:39: error: expected integer type, found 'f32'
test/cases/compile_errors/export_with_empty_name_string.zig-2
......@@ -4,7 +4,5 @@ comptime {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :3:5: error: unable to export type 'type'
1513// :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 {
88// the original bug leading to this test occurred only with the LLVM backend.
99
1010// error
11// backend=stage2,llvm
1211//
1312// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :2:8: error: extern structs cannot contain fields of type '*const fn () void'
1412// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :1:11: error: opaque types do not support 'packed' or 'extern'
1412// :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 {
3838}
3939
4040// error
41// backend=stage2
42// target=native
4341//
4442// :33:8: error: extern structs cannot contain fields of type 'tmp.E'
4543// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :3:8: error: extern structs cannot contain fields of type 'tmp.E'
1513// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :1:17: error: extern variable cannot have type 'u3'
119// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :5:28: error: no field named 'a' in struct 'tmp.Foo'
1311// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :11:41: error: field 'b' has index '1' but pointer value is index '0' of struct 'tmp.Foo'
2018// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :5:5: error: no offset available for comptime field
1614// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :4:32: error: type '[]i32' has no members
1311// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :6:8: error: optional type '?tmp.Foo' does not support field access
1816// :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 {
55};
66
77// error
8// backend=stage2
9// target=native
108//
119// :2:8: error: enum fields do not have types
1210// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :7:15: error: expected type 'type', found 'fn () type'
test/cases/compile_errors/float exact division failure.zig -2
......@@ -4,7 +4,5 @@ comptime {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:15: error: exact division produced remainder
test/cases/compile_errors/for_discard_unbounded.zig-2
......@@ -4,7 +4,5 @@ export fn a() void {
44 }
55}
66// error
7// backend=stage2
8// target=native
97//
108// :2:27: error: discard of unbounded counter
test/cases/compile_errors/for_empty.zig-2
......@@ -5,7 +5,5 @@ export fn b() void {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :2:10: error: expected expression, found ')'
test/cases/compile_errors/for_extra_capture.zig-2
......@@ -8,7 +8,5 @@ export fn b() void {
88// zig fmt: on
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
2525}
2626
2727// error
28// backend=stage2
29// target=native
3028//
3129// :2:13: error: expected type 'usize', found '*const [5:0]u8'
3230// :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 {
1818}
1919
2020// error
21// backend=stage2
22// target=native
2321//
2422// :5:30: error: value of type 'usize' ignored
2523// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :6:5: error: incompatible types: 'usize' and 'void'
1614// :7:22: note: type 'usize' here
test/cases/compile_errors/for_loop_error_union.zig-2
......@@ -7,8 +7,6 @@ export fn a() void {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :6:11: error: type '@typeInfo(@typeInfo(@TypeOf(tmp.b)).@"fn".return_type.?).error_union.error_set!u32' is not indexable and not a range
1412// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :2:5: error: unbounded for loop
test/cases/compile_errors/function-only_builtins_outside_function.zig-2
......@@ -47,8 +47,6 @@ comptime {
4747}
4848
4949// error
50// backend=stage2
51// target=native
5250//
5351// :2:5: error: '@branchHint' outside function scope
5452// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 @@
11export fn entry() align(64) void {}
22
33// error
4// backend=stage2
54// target=nvptx-cuda,nvptx64-cuda,spirv32-opengl,spirv32-vulkan,spirv32-opencl,spirv64-opencl,spirv64-amdhsa,wasm32-freestanding,wasm64-freestanding
65//
76// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :3:17: error: expected type '[4]f32', found '[16]f32'
1412// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :3:28: error: parameter of opaque type 'tmp.FooType' not allowed
1917// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :1:1: error: non-extern function has no body
test/cases/compile_errors/function_ptr_alignment.zig-1
......@@ -9,7 +9,6 @@ comptime {
99}
1010
1111// error
12// backend=stage2
1312// target=x86_64-linux
1413//
1514// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:17: error: opaque return type 'tmp.FooType' not allowed
119// :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 {
1010}
1111
1212// error
13// backend=stage2,llvm
14// target=native
1513//
1614// :3:25: error: expected type 'fn () void', found 'fn (i32) void'
1715// :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 @@
11const aFunc = fn someFunc(x: i32) void;
22
33// error
4// backend=stage2
5// target=native
64//
75// :1:18: error: function type cannot have a name
test/cases/compile_errors/function_with_invalid_return_type.zig-2
......@@ -1,7 +1,5 @@
11export fn foo() boid {}
22
33// error
4// backend=stage2
5// target=native
64//
75// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
1919}
2020
2121// error
22// backend=stage2
23// target=native
2422//
2523// :18:43: error: value of type 'type' ignored
2624// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :6:17: error: unable to evaluate comptime expression
1412// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :2:18: error: expected type 'u32', found 'error{Ohno}'
2321// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :2:9: error: expected type 'bool', found 'comptime_int'
1412// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:11: error: value of type 'i32' ignored
1311// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :3:9: error: value of type 'comptime_int' ignored
1210// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :2:5: error: value of type 'comptime_int' ignored
1614// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :2:14: error: error union is ignored
2018// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :3:9: error: value of type 'comptime_int' ignored
1210// :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 {
2323}
2424
2525// error
26// backend=stage2
27// target=native
2826//
2927// :2:24: error: error union is ignored
3028// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:8: error: value of type 'i32' ignored
1311// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:5: error: value of type 'comptime_int' ignored
108// :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 {
1717}
1818
1919// error
20// backend=stage2
21// target=native
2220//
2321// :2:14: error: operator == not allowed for type '[]u8'
2422// :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 {
3535}
3636
3737// error
38// backend=stage2
3938// target=spirv64-vulkan
4039//
4140// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :2:12: error: expected type '[:255]const u8', found '*const [4:0]u8'
1917// :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 {
3030}
3131
3232// error
33// backend=stage2
34// target=native
3533//
3634// :3:27: error: expected type '*align(4) u8', found '[*c]u8'
3735// :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 {
2020}
2121
2222// error
23// backend=stage2
24// target=native
2523//
2624// :3:26: error: expected type '[]u8', found '*const [1]u8'
2725// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :2:14: error: expected type 'f32', found 'f64'
1816// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :7:21: error: expected type 'error{A,C}', found 'error{A,B}'
1614// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :3:21: error: expected type '[*c]u8', found 'u65'
1412// :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 {
2020}
2121
2222// error
23// backend=stage2
24// target=native
2523//
2624// :6:24: error: expected type '*const [*]const u8', found '[*c]const [*c]const u8'
2725// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
44}
55
66// error
7// backend=stage2
87// target=native-linux
98//
109// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :4:11: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-block_statement.zig-2
......@@ -8,7 +8,5 @@ export fn entry() void {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :4:9: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-comptime_expression.zig-2
......@@ -8,7 +8,5 @@ export fn entry() void {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :4:20: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-comptime_statement.zig-2
......@@ -8,7 +8,5 @@ export fn entry() void {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :4:18: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-defer.zig-2
......@@ -8,7 +8,5 @@ export fn entry() void {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :4:15: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-for_expression.zig-2
......@@ -9,7 +9,5 @@ export fn entry() void {
99fn foo() void {}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :4:26: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-for_statement.zig-2
......@@ -9,7 +9,5 @@ export fn entry() void {
99fn foo() void {}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :4:28: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-if_expression.zig-2
......@@ -8,7 +8,5 @@ export fn entry() void {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :4:20: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-if_statement.zig-2
......@@ -8,7 +8,5 @@ export fn entry() void {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
99fn foo() void {}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :4:26: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-test_statement.zig-2
......@@ -9,7 +9,5 @@ export fn entry() void {
99fn foo() void {}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :4:23: error: expected ';' after statement
test/cases/compile_errors/implicit_semicolon-while_statement.zig-2
......@@ -8,7 +8,5 @@ export fn entry() void {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :9:22: error: expected type 'u2', found 'tmp.Small'
1816// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :8:9: error: expected type '*u32', found '*align(1) u32'
2018// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :9:22: error: expected type '*[1]u32', found '*align(1) u32'
2119// :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) {
88 return .{ 1, 2, 3, 4 };
99}
1010// error
11// backend=stage2
12// target=native
1311//
1412// :5:15: error: expected type 'anyerror![4]u32', found 'anyerror!@Vector(4, u32)'
1513// :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 {
2222 }
2323}
2424// error
25// backend=stage2
26// target=native
2725//
2826// :15:17: error: incompatible types: '*align(1:0:1) u2' and '*align(2:8:2) u2'
2927// :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 {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :4:12: error: expected type '[*:0]u8', found '[*:255]u8'
2321// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :8:15: error: expected type 'tmp.A', found 'tmp.B'
2220// :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 {
6363}
6464
6565// error
66// backend=stage2
67// target=native
6866//
6967// :5:5: error: unknown copy length
7068// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :3:23: error: @ptrCast increases pointer alignment
1210// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :4:6: error: type 'tmp.a.S' does not support indexing
1210// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:15: error: type '*i32' does not support indexing
108// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :2:16: error: unable to infer array size
1614// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :1:13: error: union 'tmp.Foo' depends on itself
test/cases/compile_errors/intFromFloat_comptime_safety.zig-2
......@@ -9,8 +9,6 @@ comptime {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :2:31: error: float value '-129.10000610351562' cannot be stored in integer type 'i8'
1614// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :5:22: error: cannot use @intFromEnum on empty enum 'tmp.a.E'
1311// :2:15: note: enum declared here
test/cases/compile_errors/int_from_ptr_to_optional.zig-2
......@@ -5,8 +5,6 @@ comptime {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :4:9: error: unable to evaluate comptime expression
1210// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :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 {
2020}
2121
2222// error
23// backend=stage2
24// target=native
2523//
2624// :3:31: error: type 'u8' cannot represent integer value '300'
2725// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
77
88// error
99// output_mode=Exe
10// backend=stage2,llvm
1110// target=x86_64-linux,x86_64-macos
1211//
1312// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// 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 {
66}
77
88// error
9// target=native
10// backend=stage2
119//
1210// :5:12: error: expected type 'type', found 'fn () type'
test/cases/compile_errors/invalid_array_elem_type.zig-2
......@@ -6,8 +6,6 @@ comptime {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:12: error: array of opaque type 'anyopaque' not allowed
1311// :5:12: error: array of 'noreturn' not allowed
test/cases/compile_errors/invalid_assignments.zig-2
......@@ -11,8 +11,6 @@ export fn entry4() void {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :3:6: error: invalid left-hand side to assignment
1816// :7:7: error: invalid left-hand side to assignment
test/cases/compile_errors/invalid_bit_pointer.zig-2
......@@ -6,8 +6,6 @@ comptime {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:18: error: packed type 'u8' at bit offset 32 starts 0 bits after the end of a 4 byte host integer
1311// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:5: error: break expression outside loop
test/cases/compile_errors/invalid_builtin_fn.zig-2
......@@ -4,7 +4,5 @@ export fn entry() void {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :1:8: error: invalid builtin function: '@bogus'
test/cases/compile_errors/invalid_capture_type.zig-2
......@@ -17,8 +17,6 @@ export fn f5() void {
1717}
1818
1919// error
20// backend=stage2
21// target=native
2220//
2321// :2:9: error: expected optional type, found 'bool'
2422// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :9:10: error: expected type 'usize', found 'tmp.E'
1816// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :2:41: error: type 'u8' cannot represent integer value '256'
2119// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :3:22: error: type 'u8' cannot represent integer value '256'
test/cases/compile_errors/invalid_compare_string.zig-2
......@@ -27,8 +27,6 @@ comptime {
2727}
2828
2929// error
30// backend=stage2
31// target=native
3230//
3331// :3:11: error: cannot compare strings with !=
3432// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
1212};
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :2:5: error: union fields cannot be marked comptime
1917// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:5: error: continue expression outside loop
test/cases/compile_errors/invalid_decltest.zig-2
......@@ -6,8 +6,6 @@ export fn foo() void {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :4:14: error: cannot test a local constant
1311// :2:11: note: local constant declared here
test/cases/compile_errors/invalid_dependency_on_struct_size.zig-2
......@@ -12,7 +12,5 @@ comptime {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :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 {
1111};
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :3:17: error: cannot dereference non-pointer type 'tmp.Tile'
1816// :8:14: note: enum declared here
test/cases/compile_errors/invalid_destructure_astgen.zig-2
......@@ -13,8 +13,6 @@ export fn bar() void {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :2:25: error: expected 2 elements for destructure, found 3
2018// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :3:28: error: type 'anyerror!u32' cannot be destructured
1311// :3:26: note: result destructured here
test/cases/compile_errors/invalid_destructure_sema.zig-2
......@@ -14,8 +14,6 @@ export fn bar() void {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :2:24: error: type 'comptime_int' cannot be destructured
2119// :2:22: note: result destructured here
test/cases/compile_errors/invalid_duplicate_test_decl_name.zig-2
......@@ -2,8 +2,6 @@ test "thingy" {}
22test "thingy" {}
33
44// error
5// backend=stage2
6// target=native
75// is_test=true
86//
97// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
1919}
2020
2121// error
22// backend=stage2
23// target=native
2422//
2523// :2:15: error: discard of error capture; omit it instead
2624// :3:9: error: use of undeclared identifier '_'
test/cases/compile_errors/invalid_error_union_payload_type.zig-2
......@@ -12,8 +12,6 @@ comptime {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :2:18: error: error union with payload of opaque type 'anyopaque' not allowed
1917// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:29: error: invalid digit 'F' in exponent
test/cases/compile_errors/invalid_field_access_in_comptime.zig-2
......@@ -4,7 +4,5 @@ comptime {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
2929}
3030
3131// error
32// backend=stage2
33// target=native
3432//
3533// :10:10: error: no field named 'foo' in struct 'tmp.A'
3634// :1:11: note: struct declared here
test/cases/compile_errors/invalid_float_casts.zig-2
......@@ -20,8 +20,6 @@ export fn qux() void {
2020}
2121
2222// error
23// backend=stage2
24// target=native
2523//
2624// :4:40: error: unable to cast runtime value to 'comptime_float'
2725// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :5:29: error: expected expression, found '.'
test/cases/compile_errors/invalid_function_types.zig-2
......@@ -15,8 +15,6 @@ comptime {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :2:12: error: function type cannot have a name
2220// :5:21: error: function type cannot have an alignment
test/cases/compile_errors/invalid_identifiers.zig-2
......@@ -18,8 +18,6 @@ comptime {
1818}
1919
2020// error
21// backend=stage2
22// target=native
2321//
2422// :1:8: error: library name cannot be empty
2523// :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 {
2323}
2424
2525// error
26// backend=stage2
27// target=native
2826//
2927// :3:34: error: type 'u8' cannot represent integer value '256'
3028// :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 {
2222}
2323
2424// error
25// backend=stage2
26// target=native
2725//
2826// :5:21: error: cannot enumerate values of type 'anyerror' for 'inline else'
2927// :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 {
2020}
2121
2222// error
23// backend=stage2
24// target=native
2523//
2624// :4:36: error: unable to cast runtime value to 'comptime_int'
2725// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :3:38: error: enum 'builtin.OptimizeMode' has no member named 'x86'
1210// : note: enum declared here
test/cases/compile_errors/invalid_multiple_dereferences.zig-2
......@@ -13,8 +13,6 @@ pub const Box = struct {
1313};
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :4:8: error: cannot dereference non-pointer type 'tmp.Box'
2018// :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 {
1919}
2020
2121// error
22// backend=stage2
23// target=native
2422//
2523// :12:16: error: runtime coercion to union 'tmp.U' from non-exhaustive enum
2624// :1:11: note: enum declared here
test/cases/compile_errors/invalid_number_literals.zig-2
......@@ -18,8 +18,6 @@ comptime {
1818}
1919
2020// error
21// backend=stage2
22// target=native
2321//
2422// :2:11: error: unexpected period after exponent
2523// :5:11: error: unexpected period after exponent
test/cases/compile_errors/invalid_optional_payload_type.zig-2
......@@ -6,8 +6,6 @@ comptime {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:10: error: opaque type 'anyopaque' cannot be optional
1311// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:10: error: extern structs cannot contain fields of type '?[*c]u8'
1311// :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 {
2424}
2525
2626// error
27// backend=stage2
28// target=native
2927//
3028// :5:9: error: incompatible types: '?@Vector(10, i32)' and '@Vector(11, i32)'
3129// :5:17: note: type '?@Vector(10, i32)' here
test/cases/compile_errors/invalid_pointer_arithmetic.zig-2
......@@ -38,8 +38,6 @@ comptime {
3838}
3939
4040// error
41// backend=stage2
42// target=native
4341//
4442// :2:11: error: invalid pointer-integer arithmetic operator
4543// :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 {
77
88// error
99// output_mode=Exe
10// backend=stage2,llvm
1110// target=x86_64-linux,x86_64-macos
1211//
1312// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
7070}
7171
7272// error
73// target=native
74// backend=stage2
7573//
7674// :6:9: error: value stored in comptime field does not match the default value of the field
7775// :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 {
2020}
2121
2222// error
23// backend=stage2
24// target=native
2523//
2624// :4:7: error: no field named 'foo' in struct 'tmp.A'
2725// :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 {
3737}
3838
3939// error
40// backend=stage2
41// target=native
4240//
4341// :5:19: error: type 'u8' cannot represent integer value '256'
4442// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :5:33: error: cannot capture tag of non-union type 'tmp.E'
1513// :1:11: note: enum declared here
test/cases/compile_errors/invalid_tail_call.zig-1
......@@ -7,6 +7,5 @@ pub export fn entry() void {
77
88// error
99// backend=llvm
10// target=native
1110//
1211// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :1:19: error: extern symbol cannot have type '*comptime_int'
1513// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:27: error: trailing digit separator
test/cases/compile_errors/invalid_unicode_escape.zig-2
......@@ -3,8 +3,6 @@ export fn entry() void {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
1414}
1515
1616// error
17// backend=stage2
1817// target=x86_64-linux
1918//
2019// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:29: error: expected type 'u32', found 'tmp'
119// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :3:37: error: cannot @bitCast from '*[2]u8'
1715// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:18: error: expected type '[*:0]const u8', found '*[64]u8'
119// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :7:28: error: expected type '[]u8', found '*const [3:0]u8'
1816// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :4:13: error: expected type '*anyopaque', found '?*anyopaque'
1210// :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 @@
11pub const empty = return 1;
22
33// error
4// backend=stage2
5// target=native
64//
75// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :2:15: error: primitive integer type 'u000123' has leading zero
2321// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :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 {
55fn foo() void {}
66
77// error
8// backend=stage2
9// target=native
108//
119// :2:9: error: local variable shadows declaration of 'foo'
1210// :5:1: note: declared here
test/cases/compile_errors/local_variable_redeclaration.zig-2
......@@ -4,8 +4,6 @@ export fn f() void {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:9: error: redeclaration of local constant 'a'
119// :2:11: note: previous declaration here
test/cases/compile_errors/local_variable_redeclares_parameter.zig-2
......@@ -6,8 +6,6 @@ export fn entry() void {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:11: error: local constant 'a' shadows function parameter from outer scope
1311// :1:6: note: previous declaration here
test/cases/compile_errors/local_variable_shadowing_global.zig-2
......@@ -7,8 +7,6 @@ export fn entry() void {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :5:9: error: local variable shadows declaration of 'Bar'
1412// :2:1: note: declared here
test/cases/compile_errors/locally_shadowing_a_primitive_type.zig-2
......@@ -5,8 +5,6 @@ export fn foo() void {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :2:11: error: name shadows primitive 'u8'
1210// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :1:23: error: use of undeclared identifier 'bogus'
test/cases/compile_errors/main_missing_name.zig-2
......@@ -1,8 +1,6 @@
11pub fn (main) void {}
22
33// error
4// backend=stage2
5// target=native
64// output_mode=Exe
75//
86// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :7:6: error: member function expected 2 argument(s), found 1
1513// :3:5: note: function declared here
test/cases/compile_errors/memset_no_length.zig-2
......@@ -10,8 +10,6 @@ export fn bar() void {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :4:5: error: unknown @memset length
1715// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :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'
2119// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :14:9: error: no field or member function named 'init' in 'tmp.Foo'
2220// :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 {
2424}
2525
2626// error
27// backend=stage2
28// target=native
2927//
3028// :23:6: error: no field or member function named 'init' in 'tmp.List'
3129// :1:18: note: struct declared here
test/cases/compile_errors/minmax_missing_args.zig-2
......@@ -2,8 +2,6 @@ comptime { _ = @min(1); }
22comptime { _ = @max(1); }
33
44// error
5// backend=stage2
6// target=native
75//
86// :1:16: error: expected at least 2 arguments, found 1
97// :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 };
1919const Union = union { foo: void };
2020
2121// error
22// backend=stage2
23// target=native
2422//
2523// :2:24: error: expected number, found 'type'
2624// :3:24: error: expected number, found 'void'
test/cases/compile_errors/missing_boolean_switch_value.zig-2
......@@ -12,8 +12,6 @@ comptime {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :2:15: error: switch must handle all possibilities
1917// :8:15: error: switch must handle all possibilities
test/cases/compile_errors/missing_builtin_arg_in_initializer.zig-2
......@@ -9,8 +9,6 @@ comptime {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :2:15: error: expected 2 arguments, found 0
1614// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
3131 k(true);
3232}
3333// error
34// backend=stage2
35// target=native
3634//
3735// :2:20: error: expected type 'i32', found 'void'
3836// :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 {
2323 _ = c;
2424}
2525// error
26// backend=stage2
27// target=native
2826//
2927// :9:16: error: missing struct field: x
3028// :1:11: note: struct declared here
test/cases/compile_errors/missing_function_name.zig-2
......@@ -1,7 +1,5 @@
11fn () void {}
22
33// error
4// backend=stage2
5// target=native
64//
75// :1:1: error: missing function name
test/cases/compile_errors/missing_function_proto_name.zig-2
......@@ -1,7 +1,5 @@
11fn () void;
22
33// error
4// backend=stage2
5// target=native
64//
75// :1:1: error: missing function name
test/cases/compile_errors/missing_param_name.zig-2
......@@ -4,7 +4,5 @@ export fn entry() usize {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :1:6: error: missing parameter name
test/cases/compile_errors/missing_parameter_name.zig-2
......@@ -9,8 +9,6 @@ fn f1(x) u64 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :1:7: error: missing parameter name
1614// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :5:11: error: incompatible types: 'void' and 'comptime_int'
1311// :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 {
2929}
3030
3131// error
32// backend=stage2
33// target=native
3432//
3533// :5:16: error: use of undeclared identifier 'JsonList'
test/cases/compile_errors/muladd_int_vector.zig-2
......@@ -3,7 +3,5 @@ comptime {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:10: error: integer literal '-0' is ambiguous
108// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :5:34: error: expected type '?error{NextError}!i32', found '?error{OutOfMemory}!i32'
1816// :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 {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :15:28: error: expected type '*const fn (type, u8, u8) u32', found '*const fn (void, u8, u8) u32'
2321// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :3:45: error: null pointer casted to type '*const u32'
1816// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :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 {}
1111fn bar(noalias _: *i32, _: *i32) void {}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :3:9: error: expected type 'fn (noalias *i32, noalias *i32) void', found 'fn (noalias *i32, *i32) void'
1816// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :2:15: error: value with comptime-only type 'comptime_int' depends on runtime control flow
1816// :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 {
3333}
3434
3535// error
36// backend=stage2
37// target=native
3836//
3937// :2:9: error: variable of type '*const comptime_int' must be const or comptime
4038// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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) {
55};
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :4:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value
2119// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :7:10: error: values of type '[2]tmp.Foo' must be comptime-known, but index value is runtime-known
1715// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :6:12: error: unable to resolve comptime value
1816// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :2:20: error: expected error set type, found 'u8'
1513// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
1818}
1919
2020// error
21// backend=stage2
22// target=native
2321//
2422// :3:5: error: error union payload is ignored
2523// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :3:5: error: unreachable code
1917// :2:5: note: control flow is diverted here
test/cases/compile_errors/noreturn_struct_field.zig-2
......@@ -6,7 +6,5 @@ comptime {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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
22b";
33
44// error
5// backend=stage2
6// target=native
75//
86// :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 {};
1313const ExpectedVarDeclOrFn = struct {};
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :4:9: error: expected type '@typeInfo(tmp.Error).@"union".tag_type.?', found 'type'
2018// :8:15: note: enum declared here
test/cases/compile_errors/number_literal_bad_exponent.zig-2
......@@ -4,8 +4,6 @@ const c = 0x1E-4;
44const d = 0x1E+4;
55
66// error
7// backend=stage2
8// target=native
97//
108// :1:15: error: sign '-' cannot follow digit 'e' in hex base
119// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :7:9: error: no field named 'a' in struct 'tmp.Foo'
1614// :1:13: note: struct declared here
test/cases/compile_errors/offsetOf-non_struct.zig-2
......@@ -4,7 +4,5 @@ export fn foo() usize {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :2:8: error: extern structs cannot contain fields of type 'fn () callconv(.c) void'
1614// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
66 return x.?;
77}
88// error
9// backend=stage2
10// target=native
119//
1210// :6:13: error: unable to unwrap null
1311// :2:17: note: called at comptime here
test/cases/compile_errors/out_of_bounds_index.zig-1
......@@ -21,7 +21,6 @@ comptime {
2121}
2222
2323// error
24// target=native
2524//
2625// :4:32: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)
2726// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
4343}
4444
4545// error
46// backend=stage2
47// target=native
4846//
4947// :2:31: error: backing integer type 'u32' has bit size 32 but the struct fields have a total bit size of 29
5048// :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 {
2222};
2323
2424// error
25// backend=stage2
26// target=native
2725//
2826// :5:11: error: operator > not allowed for type 'tmp.Foo'
2927// :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 {
7878}
7979
8080// error
81// backend=stage2
82// target=native
8381//
8482// :3:12: error: packed structs cannot contain fields of type 'anyerror'
8583// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:16: error: packed union has fields with mismatching bit sizes
1311// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :6:8: error: packed unions cannot contain fields of type 'tmp.Foo'
1917// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :10:5: error: panic
test/cases/compile_errors/parameter_redeclaration.zig-2
......@@ -4,8 +4,6 @@ export fn entry() void {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :1:14: error: redeclaration of function parameter 'a'
119// :1:6: note: previous declaration here
test/cases/compile_errors/parameter_shadowing_global.zig-2
......@@ -5,8 +5,6 @@ export fn entry() void {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :2:6: error: function parameter shadows declaration of 'Foo'
1210// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :4:19: error: expected type '*[]const u8', found '*const []const u8'
2119// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :4:31: error: expected type '*i32', found '*align(1) i32'
1311// :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 {
99}
1010
1111// error
12// backend=stage2
1312// target=x86_64-linux
1413//
1514// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:32: error: expected type '[*c]u8', found '*const [0:0]u8'
119// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :4:17: error: incompatible types: '*[10]u8' and 'comptime_int'
1311// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :2:29: error: expected type '[][]const u8', found '*const [2][]const u8'
2018// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
77
88// error
99// output_mode=Obj
10// backend=stage2,llvm
1110// target=x86_64-linux,x86_64-macos
1211//
1312// :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 {
77
88// error
99// output_mode=Exe
10// backend=stage2,llvm
1110// target=x86_64-linux,x86_64-macos
1211//
1312// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :4:9: error: pointless discard of local variable
2018// :3:5: note: used here
test/cases/compile_errors/popCount-non-integer.zig-2
......@@ -3,7 +3,5 @@ export fn entry(x: f32) u32 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :3:21: error: @ptrCast discards const qualifier
1210// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :2:18: error: expected pointer type, found 'i32'
1412// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :3:25: error: expected type '[]const u8', found '[*]const u8'
1917// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :2:34: error: ranges not allowed when switching on type '@typeInfo(@typeInfo(@TypeOf(tmp.foo)).@"fn".return_type.?).error_union.error_set'
2018// :3:18: note: range here
test/cases/compile_errors/reading_past_end_of_pointer_casted_array.zig-2
......@@ -14,8 +14,6 @@ comptime {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :5:26: error: dereference of '*const u24' exceeds bounds of containing decl of type '[4]u8'
2119// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :5:5: error: cannot assign to constant
test/cases/compile_errors/redefinition_of_enums.zig-2
......@@ -2,8 +2,6 @@ const A = enum { x };
22const A = enum { x };
33
44// error
5// backend=stage2
6// target=native
75//
86// :1:7: error: duplicate struct member name 'A'
97// :2:7: note: duplicate name here
test/cases/compile_errors/redefinition_of_global_variables.zig-2
......@@ -2,8 +2,6 @@ var a: i32 = 1;
22var a: i32 = 2;
33
44// error
5// backend=stage2
6// target=native
75//
86// :1:5: error: duplicate struct member name 'a'
97// :2:5: note: duplicate name here
test/cases/compile_errors/redefinition_of_struct.zig-2
......@@ -2,8 +2,6 @@ const A = struct { x: i32 };
22const A = struct { y: i32 };
33
44// error
5// backend=stage2
6// target=native
75//
86// :1:7: error: duplicate struct member name 'A'
97// :2:7: note: duplicate name here
test/cases/compile_errors/redundant_ptr_cast.zig-2
......@@ -11,8 +11,6 @@ export fn c() void {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :3:18: error: redundant @ptrCast
1816// :6:44: error: redundant @alignCast
test/cases/compile_errors/reference_to_const_data.zig-2
......@@ -27,8 +27,6 @@ export fn quux() void {
2727}
2828
2929// error
30// backend=stage2
31// target=native
3230//
3331// :3:8: error: cannot assign to constant
3432// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :12:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.get_uval)).@"fn".return_type.?).error_union.error_set!u32'
2220// :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 {
1313}
1414
1515// error
16// target=native
17// backend=stage2
1816//
1917// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :2:9: error: duplicate enum field 'A'
2018// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :2:9: error: enum tag value 10 already taken
2018// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :4:9: error: incompatible types: 'f32' and 'u32'
1311// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :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 {
2828}
2929
3030// error
31// backend=stage2
32// target=native
3331//
3432// :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 {
2828}
2929
3030// error
31// backend=stage2
32// target=native
3331//
3432// :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 {
2727}
2828
2929// error
30// backend=stage2
31// target=native
3230//
3331// :13:16: error: enum fields missing in union
3432// :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 {
2727}
2828
2929// error
30// backend=stage2
31// target=native
3230//
3331// :12:16: error: no field named 'arst' in enum 'tmp.Tag'
3432// :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 {
2323}
2424
2525// error
26// backend=stage2
27// target=native
2826//
2927// :9:16: error: no field named 'signed' in enum 'tmp.Tag'
3028// :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 {
2323}
2424
2525// error
26// backend=stage2
27// target=native
2826//
2927// :12:16: error: enum fields missing in union
3028// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :1:18: error: opaque types have unknown size and therefore cannot be directly embedded in unions
2018// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :3:31: error: expected type 'builtin.Type', found 'builtin.Type.Int'
1412// :?:?: 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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :1:1: error: extern functions have no body
test/cases/compile_errors/reject_extern_variables_with_initializers.zig-2
......@@ -1,7 +1,5 @@
11extern var foo: int = 2;
22
33// error
4// backend=stage2
5// target=native
64//
75// :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" {
77}
88
99// error
10// backend=stage2
11// target=native
1210// is_test=true
1311//
1412// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :10:15: error: unable to resolve inferred error set of generic function
1816// :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 {
1212};
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :3:23: error: expected type 'i32', found '?i32'
1917// :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 {
1212};
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :3:23: error: expected type 'i32', found '?i32'
1917// :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 {
1717}
1818
1919// error
20// backend=stage2
21// target=native
2220//
2321// :4:11: error: 'try' not allowed inside defer expression
2422// :4:5: note: defer expression here
test/cases/compile_errors/return_from_naked_function.zig-2
......@@ -7,8 +7,6 @@ comptime {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :2:5: error: cannot return from naked function
1412// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :8:18: error: expected type 'tmp.A(u32)', found 'tmp.B(u32)'
1917// :5:12: note: struct declared here
test/cases/compile_errors/return_invalid_type_from_test.zig-2
......@@ -3,8 +3,6 @@ test "example" {
33}
44
55// error
6// backend=stage2
7// target=native
86// is_test=true
97//
108// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:12: error: function declared 'noreturn' returns
108// :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 {
99}
1010
1111// error
12// target=native
1312//
1413// :5:54: error: pointer to comptime-only type '?*tmp.GuSettings' must be comptime-known, but operand is runtime-known
1514// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :11:22: error: runtime coercion from enum 'tmp.Letter' to union 'tmp.Value' which has non-void fields
2018// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :9:54: error: values of type '[]const builtin.Type.StructField' must be comptime-known, but index value is runtime-known
1816// : 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 {
2323 _ = &i;
2424}
2525// error
26// target=native
27// backend=stage2
2826//
2927// :7:10: error: values of type '[2]fn () void' must be comptime-known, but index value is runtime-known
3028// :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 {
2222}
2323
2424// error
25// backend=stage2
26// target=native
2725//
2826// :4:27: error: unable to resolve comptime value
2927// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :4:9: error: unable to resolve comptime value
1412// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
2525}
2626
2727// error
28// backend=stage2
29// target=native
3028//
3129// :2:25: error: shift by negative amount '-1'
3230// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :6:12: error: variable of type 'tmp.S' must be const or comptime
1513// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :6:12: error: variable of type 'tmp.U' must be const or comptime
1513// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:20: error: expected type 'comptime_int', found pointer
119// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
2828}
2929
3030// error
31// backend=stage2
32// target=native
3331//
3432// :6:22: error: shift amount '24' is too large for operand type 'u24'
3533// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:17: error: expected type 'u3', found 'u8'
108// :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 {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be comptime-known
2321// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
66}
77
88// error
9// target=native
109//
1110// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:19: error: type '[]u8' does not support array initialization syntax
119// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:15: error: type '[]u8' does not support array initialization syntax
119// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :2:37: error: expected type '[2:1]u8', found '[2:2]u8'
1614// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :3:12: error: expected type '[:0]u8', found '[]u8'
1412// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :3:37: error: expected type '*const anyopaque', found '[]const u8'
1210// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :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 {
1111}
1212
1313// error
14// backend=stage2
1514// target=spirv64-vulkan
1615//
1716// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :?:?: 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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :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 {
99}
1010
1111// error
12// target=native
1312//
1413// :2:5: error: duplicate struct member name 'foo'
1514// :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 {
77export const value = hi(MyStruct{ .x = 12 });
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :7:33: error: expected type 'type', found 'tmp.MyStruct'
1412// :1:18: note: struct declared here
test/cases/compile_errors/struct_init_syntax_for_array.zig-2
......@@ -4,7 +4,5 @@ comptime {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :1:13: error: initializing array with struct syntax
test/cases/compile_errors/struct_type_mismatch_in_arg.zig-2
......@@ -9,8 +9,6 @@ comptime {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :7:15: error: expected type 'tmp.Foo', found 'tmp.Bar'
1614// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:12: error: expected type 'usize', found 'type'
108// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
2424}
2525
2626// error
27// backend=stage2
28// target=native
2927//
3028// :14:17: error: use of undeclared identifier 'HeaderValue'
test/cases/compile_errors/sub_sat_on_undefined_value.zig-2
......@@ -12,8 +12,6 @@ comptime {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :6:5: error: found compile log statement
1917//
test/cases/compile_errors/sub_wrap_on_undefined_value.zig-2
......@@ -12,8 +12,6 @@ comptime {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :6:5: error: found compile log statement
1917//
test/cases/compile_errors/switch_capture_incompatible_types.zig-2
......@@ -15,8 +15,6 @@ export fn g() void {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :5:20: error: capture group with incompatible types
2220// :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 {
1919}
2020
2121// error
22// backend=stage2
23// target=native
2422//
2523// :13:15: error: duplicate switch value
2624// :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 {
2020}
2121
2222// error
23// backend=stage2
24// target=native
2523//
2624// :13:15: error: duplicate switch value
2725// :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 {
2424}
2525
2626// error
27// backend=stage2
28// target=native
2927//
3028// :8:9: error: duplicate switch value
3129// :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 {
2626}
2727
2828// error
29// backend=stage2
30// target=native
3129//
3230// :8:9: error: duplicate switch value
3331// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :6:12: error: duplicate switch value
1816// :5:17: note: previous value here
test/cases/compile_errors/switch_expression-duplicate_type.zig-2
......@@ -12,8 +12,6 @@ export fn entry() usize {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :6:9: error: duplicate switch value
1917// :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 {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :10:9: error: duplicate switch value
2321// :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 {
1717}
1818
1919// error
20// backend=stage2
21// target=native
2220//
2321// :8:5: error: switch must handle all possibilities
2422// :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 {
2424}
2525
2626// error
27// backend=stage2
28// target=native
2927//
3028// :8:27: error: switch must handle all possibilities
3129// :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 {
2626}
2727
2828// error
29// backend=stage2
30// target=native
3129//
3230// :5:9: error: multiple else prongs in switch expression
3331// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :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 {
2020}
2121
2222// error
23// backend=stage2
24// target=native
2523//
2624// :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 {
2525}
2626
2727// error
28// backend=stage2
29// target=native
3028//
3129// :7:14: error: unreachable else prong; all cases already handled
3230// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :5:5: error: switch must handle all possibilities
1311// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :5:24: error: switch must handle all possibilities
1816// :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 {
1717}
1818
1919// error
20// backend=stage2
21// target=native
2220//
2321// :4:24: error: error set cannot be captured by reference
2422// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :4:42: error: invalid operands to binary expression: 'error_set' and 'comptime_int'
2220// :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 {
55}
66
77// error
8// backend=stage2
98// target=x86_64-linux
109//
1110// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :11:14: error: switch on union with no attached enum
2220// :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 {
1414}
1515
1616// error
17// backend=stage2
18// target=native
1917//
2018// :4:10: error: range start value is greater than the end value
2119// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :5:10: error: duplicate switch value
1412// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :7:5: error: '_' prong only allowed when switching on non-exhaustive enums
1917// :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 {
3131}
3232
3333// error
34// backend=stage2
35// target=native
3634//
3735// :12:5: error: switch must handle all possibilities
3836// :3:5: note: unhandled enumeration value: 'b'
test/cases/compile_errors/tab_inside_comment.zig-2
......@@ -2,7 +2,5 @@
22export fn entry() void {}
33
44// error
5// backend=stage2
6// target=native
75//
86// :1:8: error: comment contains invalid byte: '\t'
test/cases/compile_errors/tab_inside_doc_comment.zig-2
......@@ -2,7 +2,5 @@
22export fn entry() void {}
33
44// error
5// backend=stage2
6// target=native
75//
86// :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 {
77 _ = foo;
88}
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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" {
44}
55
66// error
7// backend=stage2
8// target=native
97// is_test=true
108//
119// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :7:9: error: union 'tmp.FloatInt' is untagged
1513// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :1:1: error: dependency loop detected
test/cases/compile_errors/truncate_sign_mismatch.zig-2
......@@ -16,8 +16,6 @@ export fn entry4() u8 {
1616}
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :3:26: error: expected signed integer type, found 'u32'
2321// :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 {
44fn something() anyerror!void {}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:5: error: expected type 'void', found 'anyerror'
119// :1:15: note: function cannot return an error
test/cases/compile_errors/try_return.zig-2
......@@ -4,8 +4,6 @@ pub fn foo() !void {
44pub fn bar() !void {}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:5: error: unreachable code
119// :2:9: note: control flow is diverted here
test/cases/compile_errors/tuple_declarations.zig-2
......@@ -16,8 +16,6 @@ const T = struct {
1616};
1717
1818// error
19// backend=stage2
20// target=native
2119//
2220// :2:5: error: enum field missing name
2321// :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 {
6666}
6767
6868// error
69// backend=stage2
70// target=native
7169//
7270// :18:14: error: missing tuple field with index 1
7371// :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 {
1919}
2020
2121// error
22// backend=stage2
23// target=native
2422//
2523// :3:19: error: cannot cast pointer to tuple to '[]u8'
2624// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :8:7: error: expected type '*const fn (*const u8) void', found '*const fn (u8) void'
1614// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :1:16: error: function with non-void return type 'u32' implicitly returns
1513// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :5:22: error: expected type '?fn ([*c]u8, ...) callconv(.c) void', found 'fn ([*:0]u8, ...) callconv(.c) void'
1412// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :1:11: error: variable of type 'type' must be const or comptime
119// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :5:5: error: switch must handle all possibilities
1311// :?:?: note: unhandled enumeration value: 'gt'
test/cases/compile_errors/union_access_of_inactive_field.zig-1
......@@ -10,7 +10,6 @@ comptime {
1010}
1111
1212// error
13// target=native
1413//
1514// :7:16: error: access of union field 'b' while field 'a' is active
1615// :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 {
1111}
1212
1313// error
14// backend=stage2
15// target=native
1614//
1715// :6:9: error: enum tag value 60 already taken
1816// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :8:10: error: access of union field 'float' while field 'int' is active
1614// :1:11: note: union declared here
test/cases/compile_errors/union_duplicate_enum_field.zig-1
......@@ -10,7 +10,6 @@ export fn foo() void {
1010}
1111
1212// error
13// target=native
1413//
1514// :3:5: error: duplicate union member name 'a'
1615// :4:5: note: duplicate name here
test/cases/compile_errors/union_duplicate_field_definition.zig-1
......@@ -9,7 +9,6 @@ export fn entry() void {
99}
1010
1111// error
12// target=native
1312//
1413// :2:5: error: duplicate union member name 'foo'
1514// :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 {
1515}
1616
1717// error
18// backend=stage2
19// target=native
2018//
2119// :10:5: error: no field named 'D' in enum 'tmp.Letter'
2220// :1:16: note: enum declared here
test/cases/compile_errors/union_enum_field_missing.zig-1
......@@ -14,7 +14,6 @@ export fn entry() usize {
1414}
1515
1616// error
17// target=native
1817//
1918// :7:11: error: enum field(s) missing in union
2019// :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 {
1414}
1515
1616// error
17// target=native
1817//
1918// :10:5: error: no field named 'd' in enum 'tmp.E'
2019// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :8:8: error: no field or member function named 'f' in '@typeInfo(tmp.T).@"union".tag_type.?'
1614// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
2424}
2525
2626// error
27// backend=stage2
28// target=native
2927//
3028// :10:20: error: union initializer must initialize one field
3129// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :6:20: error: expected union type, found 'tmp.S'
1412// :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 {
2929}
3030
3131// error
32// backend=stage2
33// target=native
3432//
3533// :11:14: error: cannot initialize 'noreturn' field of union
3634// :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 {
1515}
1616
1717// error
18// target=native
1918//
2019// :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields
2120// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :6:17: error: enum field(s) missing in union
1917// :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 {
99}
1010
1111// error
12// backend=stage2
13// target=native
1412//
1513// :1:22: error: specified integer tag type cannot represent every field
1614// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :1:22: error: specified integer tag type cannot represent every field
1715// :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 @@
11export const T = [*]opaque {};
22
33// error
4// backend=stage2
5// target=native
64//
75// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :3:9: error: unreachable code
1311// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:5: error: unreachable code
108// :2:12: note: control flow is diverted here
test/cases/compile_errors/unreachable_code.zig-2
......@@ -6,8 +6,6 @@ export fn a() void {
66fn b() void {}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :3:6: error: unreachable code
1311// :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 {
2121}
2222
2323// error
24// backend=stage2
25// target=native
2624//
2725// :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 {
1919}
2020
2121// error
22// backend=stage2
23// target=native
2422//
2523// :2:5: error: runtime safety check not allowed in naked function
2624// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:25: error: cannot cast to noreturn
test/cases/compile_errors/unreachable_with_return.zig-2
......@@ -6,8 +6,6 @@ export fn entry() void {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :2:5: error: function declared 'noreturn' returns
1311// :1:8: note: 'noreturn' declared here
test/cases/compile_errors/untagged_union_integer_conversion.zig-2
......@@ -4,8 +4,6 @@ comptime {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:18: error: untagged union 'tmp.UntaggedUnion' cannot be converted to integer
119// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :3:18: error: incompatible types: 'comptime_int' and 'void'
1513// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :4:24: error: expected type '*?*i32', found '**i32'
1412// :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 {
55}
66
77// error
8// backend=stage2
9// target=native
108//
119// :1:9: error: variable of type 'comptime_int' must be const or comptime
1210// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:12: error: expected type 'i32', found '*const [1:0]u8'
119// :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 {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:5: error: unreachable code
119// :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 {
1919}
2020
2121// error
22// backend=stage2
23// target=native
2422//
2523// :4:33: error: integer and float literals passed to variadic function must be casted to a fixed-size number type
2624// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :2:30: error: expected 3 vector elements; found 4
test/cases/compile_errors/volatile_on_global_assembly.zig-2
......@@ -3,7 +3,5 @@ comptime {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
44}
55
66// error
7// backend=stage2
87// target=x86_64-native
98//
109// :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 {
44}
55
66// error
7// backend=stage2
87// target=x86_64-native
98//
109// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :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 {
1010}
1111
1212// error
13// backend=stage2
14// target=native
1513//
1614// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :2:15: error: expected optional type, found 'anyerror!i32'
1513// :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 {
2727}
2828
2929// error
30// backend=stage2
31// target=native
3230//
3331// :5:25: error: value of type 'usize' ignored
3432// :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 {
2121}
2222
2323// error
24// backend=stage2
25// target=native
2624//
2725// :7:5: error: incompatible types: 'usize' and 'void'
2826// :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 {
77}
88
99// error
10// backend=stage2
11// target=native
1210//
1311// :3:5: error: cannot assign to constant
test/cases/compile_errors/wrong_function_type.zig-2
......@@ -13,8 +13,6 @@ export fn entry() usize {
1313}
1414
1515// error
16// backend=stage2
17// target=native
1816//
1917// :1:28: error: expected type 'fn () void', found 'fn () i32'
2018// :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 {
88}
99
1010// error
11// backend=stage2
12// target=native
1311//
1412// :2:5: error: expected 3 argument(s), found 1
1513// :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 {
1212}
1313
1414// error
15// backend=stage2
16// target=native
1715//
1816// :8:8: error: member function expected 1 argument(s), found 2
1917// :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 {
66}
77
88// error
9// backend=stage2
10// target=native
119//
1210// :5:9: error: expected type '*tmp.Derp', found '*anyopaque'
1311// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :2:15: error: expected type 'builtin.Type', found 'comptime_int'
108// :?:?: note: union declared here
test/cases/compile_errors/wrong_type_passed_to_panic.zig-2
......@@ -4,7 +4,5 @@ export fn entry() void {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :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 {
33}
44
55// error
6// backend=stage2
7// target=native
86//
97// :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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:47: error: expected type 'builtin.AtomicOrder', found 'u32'
119// :?:?: note: enum declared here
test/cases/compile_errors/wrong_types_given_to_export.zig-2
......@@ -4,8 +4,6 @@ comptime {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:42: error: expected type 'builtin.GlobalLinkage', found 'u32'
119// :?:?: 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 {
44}
55
66// error
7// backend=stage2
8// target=native
97//
108// :3:21: error: expected type 'u0', found '*const [4:0]u8'
119// :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 {
2323}
2424
2525// error
26// backend=stage2,llvm
27// target=native
26// backend=selfhosted,llvm
2827//
2928// :6:20: error: cannot @bitCast to '[]i32'
3029// :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 {
77}
88
99// run
10// backend=stage2,llvm
10// backend=selfhosted,llvm
1111// target=x86_64-linux-gnu
1212// link_libc=true
1313//
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 {
88}
99
1010// run
11// backend=stage2,llvm
11// backend=selfhosted,llvm
1212// 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 {
1414
1515// run
1616// is_test=true
17// backend=stage2,llvm
17// backend=selfhosted,llvm
1818//
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 {
3636// TODO: enable this for native backend
3737
3838// run
39// backend=stage2,llvm
39// backend=selfhosted,llvm
4040// 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 {
1818}
1919
2020// run
21// backend=stage2,llvm
22// target=native
21// backend=selfhosted,llvm
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 {
88}
99
1010// compile
11// backend=stage2,llvm
11// backend=selfhosted,llvm
1212// 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
1313// pic=true
1414// output_mode=Exe
test/cases/pic_linux.zig+1-1
......@@ -8,7 +8,7 @@ const std = @import("std");
88pub fn main() void {}
99
1010// run
11// backend=stage2,llvm
11// backend=selfhosted,llvm
1212// 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
1313// pic=true
1414// 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 {
77}
88
99// run
10// backend=stage2,llvm
11// target=native
10// backend=selfhosted,llvm
test/cases/safety/@alignCast misaligned.zig +1-1
......@@ -21,5 +21,5 @@ fn foo(bytes: []u8) u32 {
2121 return int_slice[0];
2222}
2323// run
24// backend=stage2,llvm
24// backend=selfhosted,llvm
2525// 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 {
2222fn baz(_: Foo) void {}
2323
2424// run
25// backend=stage2,llvm
25// backend=selfhosted,llvm
2626// target=x86_64-linux
test/cases/safety/@enumFromInt truncated bits - exhaustive.zig +1-1
......@@ -19,5 +19,5 @@ pub fn main() u8 {
1919}
2020
2121// run
22// backend=stage2,llvm
22// backend=selfhosted,llvm
2323// target=x86_64-linux
test/cases/safety/@enumFromInt truncated bits - nonexhaustive.zig +1-1
......@@ -19,5 +19,5 @@ pub fn main() u8 {
1919}
2020
2121// run
22// backend=stage2,llvm
22// backend=selfhosted,llvm
2323// 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 {
1717 return @errorCast(set1);
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1616 return error.Bar;
1717}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
1818 _ = x;
1919}
2020// run
21// backend=stage2,llvm
21// backend=selfhosted,llvm
2222// 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 {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1616}
1717fn baz(_: i8) void {}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
1616}
1717fn baz(_: u8) void {}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
1616}
1717fn baz(_: u8) void {}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// 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 {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// target=x86_64-linux,aarch64-linux
test/cases/safety/@ptrFromInt with misaligned address.zig +1-1
......@@ -15,5 +15,5 @@ pub fn main() !void {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// 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 {
2222}
2323
2424// run
25// backend=stage2,llvm
25// backend=selfhosted,llvm
2626// target=x86_64-linux
test/cases/safety/@tagName on corrupted union value.zig +1-1
......@@ -23,5 +23,5 @@ pub fn main() !void {
2323}
2424
2525// run
26// backend=stage2,llvm
26// backend=selfhosted,llvm
2727// target=x86_64-linux
test/cases/safety/array slice sentinel mismatch vector.zig +1-1
......@@ -15,5 +15,5 @@ pub fn main() !void {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// target=x86_64-linux
test/cases/safety/array slice sentinel mismatch.zig +1-1
......@@ -15,5 +15,5 @@ pub fn main() !void {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// 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 {
2323 f.float = 12.34;
2424}
2525// run
26// backend=stage2,llvm
26// backend=selfhosted,llvm
2727// target=x86_64-linux
test/cases/safety/calling panic.zig +1-1
......@@ -12,5 +12,5 @@ pub fn main() !void {
1212 return error.TestFailed;
1313}
1414// run
15// backend=stage2,llvm
15// backend=selfhosted,llvm
1616// 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 {
1717 return std.mem.bytesAsSlice(i32, slice);
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1515 return @errorFromInt(x);
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// 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 {
1717}
1818
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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) {
1919 return @divExact(a, b);
2020}
2121// run
22// backend=stage2,llvm
22// backend=selfhosted,llvm
2323// target=x86_64-linux
test/cases/safety/exact division failure.zig +1-1
......@@ -17,5 +17,5 @@ fn divExact(a: i32, b: i32) i32 {
1717 return @divExact(a, b);
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// target=x86_64-linux,aarch64-linux
test/cases/safety/for_len_mismatch.zig+1-1
......@@ -21,5 +21,5 @@ pub fn main() !void {
2121 return error.TestFailed;
2222}
2323// run
24// backend=stage2,llvm
24// backend=selfhosted,llvm
2525// target=x86_64-linux,aarch64-linux
test/cases/safety/for_len_mismatch_three.zig+1-1
......@@ -20,5 +20,5 @@ pub fn main() !void {
2020 return error.TestFailed;
2121}
2222// run
23// backend=stage2,llvm
23// backend=selfhosted,llvm
2424// target=x86_64-linux,aarch64-linux
test/cases/safety/ignored expression integer overflow.zig +1-1
......@@ -17,5 +17,5 @@ pub fn main() !void {
1717}
1818
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// target=x86_64-linux
test/cases/safety/integer addition overflow.zig +1-1
......@@ -19,5 +19,5 @@ fn add(a: u16, b: u16) u16 {
1919}
2020
2121// run
22// backend=stage2,llvm
22// backend=selfhosted,llvm
2323// 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) {
1818 return @divTrunc(a, b);
1919}
2020// run
21// backend=stage2,llvm
21// backend=selfhosted,llvm
2222// 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 {
1616 return @divTrunc(a, b);
1717}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
1717 return a * b;
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// target=x86_64-linux,aarch64-linux
test/cases/safety/integer negation overflow.zig +1-1
......@@ -17,5 +17,5 @@ fn neg(a: i16) i16 {
1717 return -a;
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1717 return a - b;
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// target=x86_64-linux,aarch64-linux
test/cases/safety/memcpy_alias.zig+1-1
......@@ -15,5 +15,5 @@ pub fn main() !void {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// target=x86_64-linux,aarch64-linux
test/cases/safety/memcpy_len_mismatch.zig+1-1
......@@ -15,5 +15,5 @@ pub fn main() !void {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// target=x86_64-linux,aarch64-linux
test/cases/safety/memmove_len_mismatch.zig+1-1
......@@ -15,5 +15,5 @@ pub fn main() !void {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// target=x86_64-linux,aarch64-linux
test/cases/safety/memset_array_undefined_bytes.zig+1-1
......@@ -14,5 +14,5 @@ pub fn main() !void {
1414 x += buffer[2];
1515}
1616// run
17// backend=stage2,llvm
17// backend=selfhosted,llvm
1818// target=x86_64-linux,aarch64-linux
test/cases/safety/memset_array_undefined_large.zig+1-1
......@@ -14,5 +14,5 @@ pub fn main() !void {
1414 x += buffer[2];
1515}
1616// run
17// backend=stage2,llvm
17// backend=selfhosted,llvm
1818// target=x86_64-linux,aarch64-linux
test/cases/safety/memset_slice_undefined_bytes.zig+1-1
......@@ -16,5 +16,5 @@ pub fn main() !void {
1616 x += buffer[2];
1717}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// target=x86_64-linux,aarch64-linux
test/cases/safety/memset_slice_undefined_large.zig+1-1
......@@ -16,5 +16,5 @@ pub fn main() !void {
1616 x += buffer[2];
1717}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
1616 return a / b;
1717}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
1616 return @mod(a, b);
1717}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// target=x86_64-linux
test/cases/safety/noreturn returned.zig +1-1
......@@ -19,5 +19,5 @@ pub fn main() void {
1919 bar();
2020}
2121// run
22// backend=stage2,llvm
22// backend=selfhosted,llvm
2323// 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 {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// 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 {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// target=x86_64-linux,aarch64-linux
test/cases/safety/optional_empty_error_set.zig+1-1
......@@ -18,5 +18,5 @@ fn foo() !void {
1818 return x.?;
1919}
2020// run
21// backend=stage2,llvm
21// backend=selfhosted,llvm
2222// 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 {
1616 return a;
1717}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
1717}
1818fn baz(_: i32) void {}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1717}
1818
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1919}
2020
2121// run
22// backend=stage2,llvm
22// backend=selfhosted,llvm
2323// target=x86_64-linux,aarch64-linux
test/cases/safety/pointer slice sentinel mismatch.zig +1-1
......@@ -17,5 +17,5 @@ pub fn main() !void {
1717}
1818
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1616 return @rem(a, b);
1717}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
1818}
1919
2020// run
21// backend=stage2,llvm
21// backend=selfhosted,llvm
2222// 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 {
1818}
1919
2020// run
21// backend=stage2,llvm
21// backend=selfhosted,llvm
2222// 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) {
1919 return @divTrunc(a, b);
2020}
2121// run
22// backend=stage2,llvm
22// backend=selfhosted,llvm
2323// 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 {
1717 return @divTrunc(a, b);
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// 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 {
1616 return @intCast(x);
1717}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
1717 return @shlExact(a, b);
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1717 return @shrExact(a, b);
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// target=x86_64-linux,aarch64-linux
test/cases/safety/signed-unsigned vector cast.zig +1-1
......@@ -17,5 +17,5 @@ pub fn main() !void {
1717}
1818
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1414 return error.TestFailed;
1515}
1616// run
17// backend=stage2,llvm
17// backend=selfhosted,llvm
1818// 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 {
1414 return error.TestFailed;
1515}
1616// run
17// backend=stage2,llvm
17// backend=selfhosted,llvm
1818// target=x86_64-linux,aarch64-linux
test/cases/safety/slice sentinel mismatch - floats.zig +1-1
......@@ -16,5 +16,5 @@ pub fn main() !void {
1616}
1717
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// target=x86_64-linux
test/cases/safety/slice sentinel mismatch - optional pointers.zig +1-1
......@@ -16,5 +16,5 @@ pub fn main() !void {
1616}
1717
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// target=x86_64-linux,aarch64-linux
test/cases/safety/slice slice sentinel mismatch.zig +1-1
......@@ -15,5 +15,5 @@ pub fn main() !void {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// 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 {
2020}
2121
2222// run
23// backend=stage2,llvm
23// backend=selfhosted,llvm
2424// 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 {
1919}
2020
2121// run
22// backend=stage2,llvm
22// backend=selfhosted,llvm
2323// 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 {
1717}
1818
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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
2323const std = @import("std");
2424
2525// run
26// backend=stage2,llvm
26// backend=selfhosted,llvm
2727// 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
2323const std = @import("std");
2424
2525// run
26// backend=stage2,llvm
26// backend=selfhosted,llvm
2727// 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
2323const std = @import("std");
2424
2525// run
26// backend=stage2,llvm
26// backend=selfhosted,llvm
2727// 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 {
1717 return error.TestFailed;
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// target=x86_64-linux,aarch64-linux
test/cases/safety/slicing null C pointer.zig +1-1
......@@ -16,5 +16,5 @@ pub fn main() !void {
1616 return error.TestFailed;
1717}
1818// run
19// backend=stage2,llvm
19// backend=selfhosted,llvm
2020// 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 {
2020 }
2121}
2222// run
23// backend=stage2,llvm
23// backend=selfhosted,llvm
2424// 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 {
2525 }
2626}
2727// run
28// backend=stage2,llvm
28// backend=selfhosted,llvm
2929// target=x86_64-linux
test/cases/safety/switch else on corrupt enum value.zig +1-1
......@@ -19,5 +19,5 @@ pub fn main() !void {
1919 }
2020}
2121// run
22// backend=stage2,llvm
22// backend=selfhosted,llvm
2323// target=x86_64-linux
test/cases/safety/switch on corrupted enum value.zig +1-1
......@@ -23,5 +23,5 @@ pub fn main() !void {
2323}
2424
2525// run
26// backend=stage2,llvm
26// backend=selfhosted,llvm
2727// 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 {
2323}
2424
2525// run
26// backend=stage2,llvm
26// backend=selfhosted,llvm
2727// target=x86_64-linux
test/cases/safety/truncating vector cast.zig +1-1
......@@ -17,5 +17,5 @@ pub fn main() !void {
1717}
1818
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// target=x86_64-linux
test/cases/safety/unreachable.zig+1-1
......@@ -11,5 +11,5 @@ pub fn main() !void {
1111 unreachable;
1212}
1313// run
14// backend=stage2,llvm
14// backend=selfhosted,llvm
1515// 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 {
1515 return error.TestFailed;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// 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 {
1717 return @shlExact(a, b);
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1717 return @shrExact(a, b);
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// target=x86_64-linux,aarch64-linux
test/cases/safety/unsigned-signed vector cast.zig +1-1
......@@ -17,5 +17,5 @@ pub fn main() !void {
1717}
1818
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// target=x86_64-linux
test/cases/safety/unwrap error switch.zig +1-1
......@@ -17,5 +17,5 @@ fn bar() !void {
1717 return error.Whatever;
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// target=x86_64-linux,aarch64-linux
test/cases/safety/unwrap error.zig +1-1
......@@ -15,5 +15,5 @@ fn bar() !void {
1515 return error.Whatever;
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// 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 {
1717 return @intCast(x);
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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 {
1717 return @intCast(x);
1818}
1919// run
20// backend=stage2,llvm
20// backend=selfhosted,llvm
2121// 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) {
1818 return a + b;
1919}
2020// run
21// backend=stage2,llvm
21// backend=selfhosted,llvm
2222// 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) {
1818 return a * b;
1919}
2020// run
21// backend=stage2,llvm
21// backend=selfhosted,llvm
2222// 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) {
1818 return -a;
1919}
2020// run
21// backend=stage2,llvm
21// backend=selfhosted,llvm
2222// 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) {
1818 return a - b;
1919}
2020// run
21// backend=stage2,llvm
21// backend=selfhosted,llvm
2222// target=x86_64-linux
test/cases/safety/zero casted to error.zig +1-1
......@@ -15,5 +15,5 @@ fn bar(x: u16) anyerror {
1515 return @errorFromInt(x);
1616}
1717// run
18// backend=stage2,llvm
18// backend=selfhosted,llvm
1919// 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 {
1212
1313// compile
1414// output_mode=Obj
15// backend=stage2
15// backend=selfhosted
1616// target=spirv64-vulkan
1717// emit_bin=false
test/cases/taking_pointer_of_global_tagged_union.zig+1-1
......@@ -22,5 +22,5 @@ pub fn main() !void {
2222}
2323
2424// run
25// backend=stage2,llvm
25// backend=selfhosted,llvm
2626// target=x86_64-linux
test/cases/union_unresolved_layout.zig+1-1
......@@ -11,5 +11,5 @@ pub fn main() !void {
1111}
1212
1313// run
14// backend=stage2,llvm
14// backend=selfhosted,llvm
1515//
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 @@
1515 .static_libs_from_object_files = .{
1616 .path = "static_libs_from_object_files",
1717 },
18 .glibc_compat = .{
19 .path = "glibc_compat",
20 },
2118 // WASM Cases
2219 .wasm_archive = .{
2320 .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 @@
11const std = @import("std");
22const expect = std.testing.expect;
3const c = @cImport(@cInclude("b.h"));
3
4extern fn sub(a: i32, b: i32) i32;
45
56test "import C sub" {
6 const result = c.sub(2, 1);
7 const result = sub(2, 1);
78 try expect(result == 1);
89}
test/src/Cases.zig+19-30
......@@ -26,8 +26,9 @@ pub const DepModule = struct {
2626};
2727
2828pub const Backend = enum {
29 stage1,
30 stage2,
29 /// Test does not care which backend is used; compiler gets to pick the default.
30 auto,
31 selfhosted,
3132 llvm,
3233};
3334
......@@ -75,7 +76,7 @@ pub const Case = struct {
7576 emit_h: bool = false,
7677 is_test: bool = false,
7778 expect_exact: bool = false,
78 backend: Backend = .stage2,
79 backend: Backend = .auto,
7980 link_libc: bool = false,
8081 pic: ?bool = null,
8182 pie: ?bool = null,
......@@ -271,26 +272,6 @@ pub fn addC(ctx: *Cases, name: []const u8, target: std.Build.ResolvedTarget) *Ca
271272 return &ctx.cases.items[ctx.cases.items.len - 1];
272273}
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
294275pub fn addTransform(
295276 ctx: *Cases,
296277 name: []const u8,
......@@ -443,13 +424,13 @@ fn addFromDirInner(
443424 const resolved_target = b.resolveTargetQuery(target_query);
444425 const target = &resolved_target.result;
445426 for (backends) |backend| {
446 if (backend == .stage2 and
427 if (backend == .selfhosted and
447428 target.cpu.arch != .aarch64 and target.cpu.arch != .wasm32 and target.cpu.arch != .x86_64 and target.cpu.arch != .spirv64)
448429 {
449430 // Other backends don't support new liveness format
450431 continue;
451432 }
452 if (backend == .stage2 and target.os.tag == .macos and
433 if (backend == .selfhosted and target.os.tag == .macos and
453434 target.cpu.arch == .x86_64 and builtin.cpu.arch == .aarch64)
454435 {
455436 // Rosetta has issues with ZLD
......@@ -638,7 +619,15 @@ pub fn lowerToBuildSteps(
638619 if (options.skip_macos and case.target.query.os_tag == .macos) continue;
639620 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 );
642631 if (options.skip_llvm and would_use_llvm) continue;
643632
644633 const triple_txt = case.target.query.zigTriple(b.allocator) catch @panic("OOM");
......@@ -707,8 +696,8 @@ pub fn lowerToBuildSteps(
707696 if (case.pie) |pie| artifact.pie = pie;
708697
709698 switch (case.backend) {
710 .stage1 => continue,
711 .stage2 => {
699 .auto => {},
700 .selfhosted => {
712701 artifact.use_llvm = false;
713702 artifact.use_lld = false;
714703 },
......@@ -787,7 +776,7 @@ const TestManifestConfigDefaults = struct {
787776 /// Asserts if the key doesn't exist - yep, it's an oversight alright.
788777 fn get(@"type": TestManifest.Type, key: []const u8) []const u8 {
789778 if (std.mem.eql(u8, key, "backend")) {
790 return "stage2";
779 return "auto";
791780 } else if (std.mem.eql(u8, key, "target")) {
792781 if (@"type" == .@"error" or @"type" == .translate_c or @"type" == .run_translated_c) {
793782 return "native";
......@@ -844,7 +833,7 @@ const TestManifestConfigDefaults = struct {
844833/// (see https://github.com/ziglang/zig/issues/11288)
845834///
846835/// error
847/// backend=stage1,stage2
836/// backend=selfhosted,llvm
848837/// output_mode=exe
849838///
850839/// :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 @@
3737 .issue_339 = .{
3838 .path = "issue_339",
3939 },
40 .issue_8550 = .{
41 .path = "issue_8550",
40 .compile_asm = .{
41 .path = "compile_asm",
4242 },
4343 .issue_794 = .{
4444 .path = "issue_794",
......@@ -49,6 +49,9 @@
4949 .pkg_import = .{
5050 .path = "pkg_import",
5151 },
52 .glibc_compat = .{
53 .path = "glibc_compat",
54 },
5255 .install_raw_hex = .{
5356 .path = "install_raw_hex",
5457 },
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;
66const Step = std.Build.Step;
77
88// Cases
9const compare_output = @import("compare_output.zig");
109const stack_traces = @import("stack_traces.zig");
11const assemble_and_link = @import("assemble_and_link.zig");
1210const translate_c = @import("translate_c.zig");
1311const run_translated_c = @import("run_translated_c.zig");
1412const llvm_ir = @import("llvm_ir.zig");
......@@ -16,7 +14,6 @@ const llvm_ir = @import("llvm_ir.zig");
1614// Implementations
1715pub const TranslateCContext = @import("src/TranslateC.zig");
1816pub const RunTranslatedCContext = @import("src/RunTranslatedC.zig");
19pub const CompareOutputContext = @import("src/CompareOutput.zig");
2017pub const StackTracesContext = @import("src/StackTrace.zig");
2118pub const DebuggerContext = @import("src/Debugger.zig");
2219pub const LlvmIrContext = @import("src/LlvmIr.zig");
......@@ -1863,25 +1860,6 @@ const c_abi_targets = blk: {
18631860 };
18641861};
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
18851863pub fn addStackTraceTests(
18861864 b: *std.Build,
18871865 test_filters: []const []const u8,
......@@ -2175,21 +2153,6 @@ pub fn addCliTests(b: *std.Build) *Step {
21752153 return step;
21762154}
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
21932156pub fn addTranslateCTests(
21942157 b: *std.Build,
21952158 parent_step: *std.Build.Step,