mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
test: migrate stage1 compile error tests to updated test manifest
This commit is contained in:
parent
c8d0fb0b21
commit
62625d9d95
35
src/test.zig
35
src/test.zig
@ -34,15 +34,12 @@ test {
|
||||
var ctx = TestContext.init(std.testing.allocator, arena);
|
||||
defer ctx.deinit();
|
||||
|
||||
const compile_errors_dir_path = try std.fs.path.join(arena, &.{
|
||||
std.fs.path.dirname(@src().file).?, "..", "test", "compile_errors",
|
||||
});
|
||||
|
||||
var compile_errors_dir = try std.fs.cwd().openDir(compile_errors_dir_path, .{});
|
||||
defer compile_errors_dir.close();
|
||||
|
||||
{
|
||||
var dir = try compile_errors_dir.openDir("stage2", .{ .iterate = true });
|
||||
const dir_path = try std.fs.path.join(arena, &.{
|
||||
std.fs.path.dirname(@src().file).?, "..", "test", "compile_errors",
|
||||
});
|
||||
|
||||
var dir = try std.fs.cwd().openDir(dir_path, .{ .iterate = true });
|
||||
defer dir.close();
|
||||
|
||||
// TODO make this incremental once the bug is solved that it triggers
|
||||
@ -50,28 +47,6 @@ test {
|
||||
ctx.addTestCasesFromDir(dir, .independent);
|
||||
}
|
||||
|
||||
if (!skip_stage1) {
|
||||
var stage1_dir = try compile_errors_dir.openDir("stage1", .{});
|
||||
defer stage1_dir.close();
|
||||
|
||||
const Config = struct {
|
||||
name: []const u8,
|
||||
is_test: bool,
|
||||
output_mode: std.builtin.OutputMode,
|
||||
};
|
||||
|
||||
for ([_]Config{
|
||||
.{ .name = "obj", .is_test = false, .output_mode = .Obj },
|
||||
.{ .name = "exe", .is_test = false, .output_mode = .Exe },
|
||||
.{ .name = "test", .is_test = true, .output_mode = .Exe },
|
||||
}) |config| {
|
||||
var dir = try stage1_dir.openDir(config.name, .{ .iterate = true });
|
||||
defer dir.close();
|
||||
|
||||
ctx.addErrorCasesFromDir("stage1", dir, .stage1, config.output_mode, config.is_test, .independent);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const dir_path = try std.fs.path.join(arena, &.{
|
||||
std.fs.path.dirname(@src().file).?, "..", "test", "incremental",
|
||||
|
||||
@ -1,11 +1,6 @@
|
||||
const std = @import("std");
|
||||
const TestContext = @import("../src/test.zig").TestContext;
|
||||
|
||||
// Self-hosted has differing levels of support for various architectures. For now we pass explicit
|
||||
// target parameters to each test case. At some point we will take this to the next level and have
|
||||
// a set of targets that all test cases run on unless specifically overridden. For now, each test
|
||||
// case applies to only the specified target.
|
||||
|
||||
pub fn addCases(ctx: *TestContext) !void {
|
||||
try @import("compile_errors.zig").addCases(ctx);
|
||||
try @import("stage2/cbe.zig").addCases(ctx);
|
||||
|
||||
@ -3,207 +3,6 @@ const builtin = @import("builtin");
|
||||
const TestContext = @import("../src/test.zig").TestContext;
|
||||
|
||||
pub fn addCases(ctx: *TestContext) !void {
|
||||
{
|
||||
const case = ctx.obj("callconv(.Interrupt) on unsupported platform", .{
|
||||
.cpu_arch = .aarch64,
|
||||
.os_tag = .linux,
|
||||
.abi = .none,
|
||||
});
|
||||
case.backend = .stage1;
|
||||
case.addError(
|
||||
\\export fn entry() callconv(.Interrupt) void {}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:28: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64",
|
||||
});
|
||||
}
|
||||
{
|
||||
var case = ctx.obj("callconv(.Signal) on unsupported platform", .{
|
||||
.cpu_arch = .x86_64,
|
||||
.os_tag = .linux,
|
||||
.abi = .none,
|
||||
});
|
||||
case.backend = .stage1;
|
||||
case.addError(
|
||||
\\export fn entry() callconv(.Signal) void {}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:28: error: callconv 'Signal' is only available on AVR, not x86_64",
|
||||
});
|
||||
}
|
||||
{
|
||||
const case = ctx.obj("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform", .{
|
||||
.cpu_arch = .x86_64,
|
||||
.os_tag = .linux,
|
||||
.abi = .none,
|
||||
});
|
||||
case.backend = .stage1;
|
||||
case.addError(
|
||||
\\const F1 = fn () callconv(.Stdcall) void;
|
||||
\\const F2 = fn () callconv(.Fastcall) void;
|
||||
\\const F3 = fn () callconv(.Thiscall) void;
|
||||
\\export fn entry1() void { var a: F1 = undefined; _ = a; }
|
||||
\\export fn entry2() void { var a: F2 = undefined; _ = a; }
|
||||
\\export fn entry3() void { var a: F3 = undefined; _ = a; }
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:27: error: callconv 'Stdcall' is only available on x86, not x86_64",
|
||||
"tmp.zig:2:27: error: callconv 'Fastcall' is only available on x86, not x86_64",
|
||||
"tmp.zig:3:27: error: callconv 'Thiscall' is only available on x86, not x86_64",
|
||||
});
|
||||
}
|
||||
{
|
||||
const case = ctx.obj("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform", .{
|
||||
.cpu_arch = .x86_64,
|
||||
.os_tag = .linux,
|
||||
.abi = .none,
|
||||
});
|
||||
case.backend = .stage1;
|
||||
case.addError(
|
||||
\\export fn entry1() callconv(.Stdcall) void {}
|
||||
\\export fn entry2() callconv(.Fastcall) void {}
|
||||
\\export fn entry3() callconv(.Thiscall) void {}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:29: error: callconv 'Stdcall' is only available on x86, not x86_64",
|
||||
"tmp.zig:2:29: error: callconv 'Fastcall' is only available on x86, not x86_64",
|
||||
"tmp.zig:3:29: error: callconv 'Thiscall' is only available on x86, not x86_64",
|
||||
});
|
||||
}
|
||||
{
|
||||
const case = ctx.obj("callconv(.Vectorcall) on unsupported platform", .{
|
||||
.cpu_arch = .x86_64,
|
||||
.os_tag = .linux,
|
||||
.abi = .none,
|
||||
});
|
||||
case.backend = .stage1;
|
||||
case.addError(
|
||||
\\export fn entry() callconv(.Vectorcall) void {}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:28: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64",
|
||||
});
|
||||
}
|
||||
{
|
||||
const case = ctx.obj("callconv(.APCS, .AAPCS, .AAPCSVFP) on unsupported platform", .{
|
||||
.cpu_arch = .x86_64,
|
||||
.os_tag = .linux,
|
||||
.abi = .none,
|
||||
});
|
||||
case.backend = .stage1;
|
||||
case.addError(
|
||||
\\export fn entry1() callconv(.APCS) void {}
|
||||
\\export fn entry2() callconv(.AAPCS) void {}
|
||||
\\export fn entry3() callconv(.AAPCSVFP) void {}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:29: error: callconv 'APCS' is only available on ARM, not x86_64",
|
||||
"tmp.zig:2:29: error: callconv 'AAPCS' is only available on ARM, not x86_64",
|
||||
"tmp.zig:3:29: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64",
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
const case = ctx.obj("call with new stack on unsupported target", .{
|
||||
.cpu_arch = .wasm32,
|
||||
.os_tag = .wasi,
|
||||
.abi = .none,
|
||||
});
|
||||
case.backend = .stage1;
|
||||
case.addError(
|
||||
\\var buf: [10]u8 align(16) = undefined;
|
||||
\\export fn entry() void {
|
||||
\\ @call(.{.stack = &buf}, foo, .{});
|
||||
\\}
|
||||
\\fn foo() void {}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack",
|
||||
});
|
||||
}
|
||||
|
||||
// Note: One of the error messages here is backwards. It would be nice to fix, but that's not
|
||||
// going to stop me from merging this branch which fixes a bunch of other stuff.
|
||||
ctx.objErrStage1("incompatible sentinels",
|
||||
\\export fn entry1(ptr: [*:255]u8) [*:0]u8 {
|
||||
\\ return ptr;
|
||||
\\}
|
||||
\\export fn entry2(ptr: [*]u8) [*:0]u8 {
|
||||
\\ return ptr;
|
||||
\\}
|
||||
\\export fn entry3() void {
|
||||
\\ var array: [2:0]u8 = [_:255]u8{1, 2};
|
||||
\\ _ = array;
|
||||
\\}
|
||||
\\export fn entry4() void {
|
||||
\\ var array: [2:0]u8 = [_]u8{1, 2};
|
||||
\\ _ = array;
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:2:12: error: expected type '[*:0]u8', found '[*:255]u8'",
|
||||
"tmp.zig:2:12: note: destination pointer requires a terminating '0' sentinel, but source pointer has a terminating '255' sentinel",
|
||||
"tmp.zig:5:12: error: expected type '[*:0]u8', found '[*]u8'",
|
||||
"tmp.zig:5:12: note: destination pointer requires a terminating '0' sentinel",
|
||||
|
||||
"tmp.zig:8:35: error: expected type '[2:255]u8', found '[2:0]u8'",
|
||||
"tmp.zig:8:35: note: destination array requires a terminating '255' sentinel, but source array has a terminating '0' sentinel",
|
||||
"tmp.zig:12:31: error: expected type '[2:0]u8', found '[2]u8'",
|
||||
"tmp.zig:12:31: note: destination array requires a terminating '0' sentinel",
|
||||
});
|
||||
|
||||
{
|
||||
const case = ctx.obj("variable in inline assembly template cannot be found", .{
|
||||
.cpu_arch = .x86_64,
|
||||
.os_tag = .linux,
|
||||
.abi = .gnu,
|
||||
});
|
||||
case.backend = .stage1;
|
||||
case.addError(
|
||||
\\export fn entry() void {
|
||||
\\ var sp = asm volatile (
|
||||
\\ "mov %[foo], sp"
|
||||
\\ : [bar] "=r" (-> usize)
|
||||
\\ );
|
||||
\\ _ = sp;
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:2:14: error: could not find 'foo' in the inputs or outputs",
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
const case = ctx.obj("bad alignment in @asyncCall", .{
|
||||
.cpu_arch = .aarch64,
|
||||
.os_tag = .linux,
|
||||
.abi = .none,
|
||||
});
|
||||
case.backend = .stage1;
|
||||
case.addError(
|
||||
\\export fn entry() void {
|
||||
\\ var ptr: fn () callconv(.Async) void = func;
|
||||
\\ var bytes: [64]u8 = undefined;
|
||||
\\ _ = @asyncCall(&bytes, {}, ptr, .{});
|
||||
\\}
|
||||
\\fn func() callconv(.Async) void {}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8'",
|
||||
});
|
||||
}
|
||||
|
||||
if (builtin.os.tag == .linux) {
|
||||
ctx.testErrStage1("implicit dependency on libc",
|
||||
\\extern "c" fn exit(u8) void;
|
||||
\\export fn entry() void {
|
||||
\\ exit(0);
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:3:5: error: dependency on libc must be explicitly specified in the build command",
|
||||
});
|
||||
|
||||
ctx.testErrStage1("libc headers note",
|
||||
\\const c = @cImport(@cInclude("stdio.h"));
|
||||
\\export fn entry() void {
|
||||
\\ _ = c.printf("hello, world!\n");
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:11: error: C import failed",
|
||||
"tmp.zig:1:11: note: libc headers not available; compilation does not link against libc",
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
const case = ctx.obj("wrong same named struct", .{});
|
||||
case.backend = .stage1;
|
||||
@ -366,21 +165,4 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
//, &[_][]const u8{
|
||||
// "tmp.zig:4:1: error: unable to inline function",
|
||||
//});
|
||||
|
||||
{
|
||||
const case = ctx.obj("align(N) expr function pointers is a compile error", .{
|
||||
.cpu_arch = .wasm32,
|
||||
.os_tag = .freestanding,
|
||||
.abi = .none,
|
||||
});
|
||||
case.backend = .stage1;
|
||||
|
||||
case.addError(
|
||||
\\export fn foo() align(1) void {
|
||||
\\ return;
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:23: error: align(N) expr is not allowed on function prototypes in wasm32/wasm64",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
pub fn (main) void {}
|
||||
|
||||
// main missing name
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
// output_mode=Exe
|
||||
//
|
||||
// tmp.zig:1:5: error: missing function name
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
|
||||
|
||||
// missing main fn in executable
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
// output_mode=Exe
|
||||
//
|
||||
// error: root source file has no member called 'main'
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
fn main() void {}
|
||||
|
||||
// private main fn
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
// output_mode=Exe
|
||||
//
|
||||
// error: 'main' is private
|
||||
// tmp.zig:1:1: note: declared here
|
||||
|
||||
@ -5,6 +5,8 @@ export fn a() void {
|
||||
_ = t;
|
||||
}
|
||||
|
||||
// C pointer pointing to non C ABI compatible type or has align attr
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:19: error: C pointers cannot point to non-C-ABI-compatible type 'Foo'
|
||||
|
||||
@ -4,6 +4,8 @@ export fn a() void {
|
||||
_ = y;
|
||||
}
|
||||
|
||||
// C pointer to anyopaque
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:16: error: C pointers cannot point to opaque types
|
||||
|
||||
@ -7,6 +7,8 @@ fn func(comptime T: type) void {
|
||||
_ = x;
|
||||
}
|
||||
|
||||
// @Frame() of generic function
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:16: error: @Frame() of generic function
|
||||
|
||||
@ -8,7 +8,9 @@ export fn f2(x: V(4, u32)) V(4, u32) {
|
||||
return -y;
|
||||
}
|
||||
|
||||
// Issue #5586: Make unary minus for unsigned types a compile error
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:12: error: negation of type 'u32'
|
||||
// tmp.zig:8:12: error: negation of type 'u32'
|
||||
|
||||
@ -3,6 +3,8 @@ fn foo() void {
|
||||
_ = sequence;
|
||||
}
|
||||
|
||||
// Issue #6823: don't allow .* to be followed by **
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:28: error: '.*' cannot be followed by '*'. Are you missing a space?
|
||||
|
||||
@ -9,6 +9,8 @@ pub fn main() !void {
|
||||
}
|
||||
}
|
||||
|
||||
// Issue #9165: windows tcp server compilation error
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// error: Unsupported OS
|
||||
|
||||
@ -4,6 +4,8 @@ comptime {
|
||||
_ = z;
|
||||
}
|
||||
|
||||
// access non-existent member of error set
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:18: error: no error named 'Bar' in 'Foo'
|
||||
|
||||
@ -12,7 +12,9 @@ export fn entry() void {
|
||||
_ = x;
|
||||
}
|
||||
|
||||
// accessing runtime parameter from outer function
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:24: error: 'y' not accessible from inner function
|
||||
// tmp.zig:3:28: note: crossed function definition here
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
a += a;
|
||||
}
|
||||
|
||||
// add assign on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
_ = a + a;
|
||||
}
|
||||
|
||||
// add on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -5,6 +5,8 @@ fn add(a: u16, b: u16) u16 {
|
||||
|
||||
export fn entry() usize { return @sizeOf(@TypeOf(y)); }
|
||||
|
||||
// add overflow in function evaluation
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:14: error: operation caused overflow
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
a +%= a;
|
||||
}
|
||||
|
||||
// add wrap assign on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
_ = a +% a;
|
||||
}
|
||||
|
||||
// add wrap on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -5,6 +5,8 @@ const x = Foo {.field = 1} + Foo {.field = 2};
|
||||
|
||||
export fn entry() usize { return @sizeOf(@TypeOf(x)); }
|
||||
|
||||
// addition with non numbers
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:28: error: invalid operands to binary expression: 'Foo' and 'Foo'
|
||||
|
||||
@ -3,6 +3,8 @@ const y = &x;
|
||||
fn foo() *const i32 { return y; }
|
||||
export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
|
||||
|
||||
// address of number literal
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:30: error: expected type '*const i32', found '*const comptime_int'
|
||||
|
||||
@ -2,6 +2,8 @@ export fn entry() void {
|
||||
@alignCast(4, @as(u32, 3));
|
||||
}
|
||||
|
||||
// @alignCast expects pointer or slice
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:19: error: expected pointer or slice, found 'u32'
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
export fn foo() align(1) void {
|
||||
return;
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=wasm32-freestanding-none
|
||||
//
|
||||
// tmp.zig:1:23: error: align(N) expr is not allowed on function prototypes in wasm32/wasm64
|
||||
@ -3,6 +3,8 @@ export fn f() void {
|
||||
_ = s;
|
||||
}
|
||||
|
||||
// aligned variable of zero-bit type
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned
|
||||
|
||||
@ -7,6 +7,8 @@ export fn entry1() void {
|
||||
_ = x;
|
||||
}
|
||||
|
||||
// alignment of enum field specified
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:7: error: expected ',' after field
|
||||
|
||||
@ -12,7 +12,9 @@ export fn entry() void {
|
||||
bar();
|
||||
}
|
||||
|
||||
// ambiguous decl reference
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:5:13: error: ambiguous reference
|
||||
// tmp.zig:7:9: note: declared here
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
_ = a and a;
|
||||
}
|
||||
|
||||
// and on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -7,7 +7,9 @@ export fn g() void {
|
||||
_ = bad[0];
|
||||
}
|
||||
|
||||
// array access of non array
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:8: error: array access of non-array type 'bool'
|
||||
// tmp.zig:7:12: error: array access of non-array type 'bool'
|
||||
|
||||
@ -3,6 +3,8 @@ export fn foo() void {
|
||||
_ = b;
|
||||
}
|
||||
|
||||
// array access of type
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:14: error: array access of non-array type 'type'
|
||||
|
||||
@ -2,6 +2,8 @@ export fn f() void {
|
||||
i[i] = i[i];
|
||||
}
|
||||
|
||||
// array access of undeclared identifier
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:5: error: use of undeclared identifier 'i'
|
||||
|
||||
@ -9,7 +9,9 @@ export fn g() void {
|
||||
_ = array[bad];
|
||||
}
|
||||
|
||||
// array access with non integer index
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:11: error: expected type 'usize', found 'bool'
|
||||
// tmp.zig:9:15: error: expected type 'usize', found 'bool'
|
||||
|
||||
@ -4,6 +4,8 @@ const a = derp ++ "foo";
|
||||
|
||||
export fn entry() usize { return @sizeOf(@TypeOf(a)); }
|
||||
|
||||
// array concatenation with wrong type
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:11: error: expected array, found 'usize'
|
||||
|
||||
@ -6,7 +6,9 @@ export fn zig_return_array() [10]u8 {
|
||||
return "1234567890".*;
|
||||
}
|
||||
|
||||
// array in c exported function
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:1:24: error: parameter of type '[10]u8' not allowed in function with calling convention 'C'
|
||||
// tmp.zig:5:30: error: return type '[10]u8' not allowed in function with calling convention 'C'
|
||||
|
||||
@ -10,6 +10,8 @@ fn doSomeAsm() void {
|
||||
);
|
||||
}
|
||||
|
||||
// asm at compile time
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:6:5: error: unable to evaluate constant expression
|
||||
|
||||
@ -4,7 +4,9 @@ export fn entry() void {
|
||||
}
|
||||
fn b() callconv(.Inline) void { }
|
||||
|
||||
// assign inline fn to non-comptime var
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var
|
||||
// tmp.zig:5:1: note: declared here
|
||||
|
||||
@ -2,6 +2,8 @@ const a: *u8 = null;
|
||||
|
||||
export fn entry() usize { return @sizeOf(@TypeOf(a)); }
|
||||
|
||||
// assign null to non-optional pointer
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:1:16: error: expected type '*u8', found '@Type(.Null)'
|
||||
|
||||
@ -3,6 +3,8 @@ export fn f() void {
|
||||
cstr[0] = 'W';
|
||||
}
|
||||
|
||||
// assign through constant pointer
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:13: error: cannot assign to constant
|
||||
|
||||
@ -3,6 +3,8 @@ export fn f() void {
|
||||
cstr[0] = 'W';
|
||||
}
|
||||
|
||||
// assign through constant slice
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:13: error: cannot assign to constant
|
||||
|
||||
@ -6,6 +6,8 @@ export fn derp() void {
|
||||
f.field = 0;
|
||||
}
|
||||
|
||||
// assign to constant field
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:6:15: error: cannot assign to constant
|
||||
|
||||
@ -3,6 +3,8 @@ export fn f() void {
|
||||
a = 4;
|
||||
}
|
||||
|
||||
// assign to constant variable
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:9: error: cannot assign to constant
|
||||
|
||||
@ -2,6 +2,8 @@ export fn entry() void {
|
||||
'a'.* = 1;
|
||||
}
|
||||
|
||||
// assign to invalid dereference
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:8: error: attempt to dereference non-pointer type 'comptime_int'
|
||||
|
||||
@ -3,6 +3,8 @@ export fn foo() void {
|
||||
_ = vga_mem;
|
||||
}
|
||||
|
||||
// assign too big number to u16
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:24: error: integer value 753664 cannot be coerced to type 'u16'
|
||||
|
||||
@ -2,7 +2,9 @@ export fn f() void {
|
||||
const a = return;
|
||||
}
|
||||
|
||||
// assign unreachable
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:5: error: unreachable code
|
||||
// tmp.zig:2:15: note: control flow is diverted here
|
||||
|
||||
@ -14,6 +14,8 @@ export fn entry() void {
|
||||
_ = s;
|
||||
}
|
||||
|
||||
// assigning to struct or union fields that are not optionals with a function that returns an optional
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:11:27: error: cannot convert optional to payload type. consider using `.?`, `orelse`, or `if`. expected type 'u8', found '?u8'
|
||||
|
||||
@ -6,6 +6,8 @@ fn amain() callconv(.Async) void {
|
||||
_ = x;
|
||||
}
|
||||
|
||||
// async function depends on its own frame
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:1: error: cannot resolve '@Frame(amain)': function not fully analyzed yet
|
||||
|
||||
@ -9,7 +9,9 @@ fn other() void {
|
||||
_ = x;
|
||||
}
|
||||
|
||||
// async function indirectly depends on its own frame
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:1: error: unable to determine async function frame of 'amain'
|
||||
// tmp.zig:5:10: note: analysis of function 'other' depends on the frame
|
||||
|
||||
@ -3,6 +3,8 @@ export fn entry() void {
|
||||
@atomicStore(u32, &x, 1, .Acquire);
|
||||
}
|
||||
|
||||
// atomic orderings of atomicStore Acquire or AcqRel
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:30: error: @atomicStore atomic ordering must not be Acquire or AcqRel
|
||||
|
||||
@ -4,6 +4,8 @@ export fn f() void {
|
||||
while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {}
|
||||
}
|
||||
|
||||
// atomic orderings of cmpxchg - failure stricter than success
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:81: error: failure atomic ordering must be no stricter than success
|
||||
|
||||
@ -4,6 +4,8 @@ export fn f() void {
|
||||
while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {}
|
||||
}
|
||||
|
||||
// atomic orderings of cmpxchg - success Monotonic or stricter
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:58: error: success atomic ordering must be Monotonic or stricter
|
||||
|
||||
@ -2,6 +2,8 @@ export fn entry() void {
|
||||
@fence(.Monotonic);
|
||||
}
|
||||
|
||||
// atomic orderings of fence Acquire or stricter
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:12: error: atomic ordering must be Acquire or stricter
|
||||
|
||||
@ -3,6 +3,8 @@ export fn entry() void {
|
||||
_ = @atomicRmw(bool, &x, .Add, true, .SeqCst);
|
||||
}
|
||||
|
||||
// atomicrmw with bool op not .Xchg
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:30: error: @atomicRmw with bool only allowed with .Xchg
|
||||
|
||||
@ -9,6 +9,8 @@ export fn entry() void {
|
||||
_ = @atomicRmw(E, &x, .Add, .b, .SeqCst);
|
||||
}
|
||||
|
||||
// atomicrmw with enum op not .Xchg
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:9:27: error: @atomicRmw with enum only allowed with .Xchg
|
||||
|
||||
@ -3,6 +3,8 @@ export fn entry() void {
|
||||
_ = @atomicRmw(f32, &x, .And, 2, .SeqCst);
|
||||
}
|
||||
|
||||
// atomicrmw with float op not .Xchg, .Add or .Sub
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:29: error: @atomicRmw with float only allowed with .Xchg, .Add and .Sub
|
||||
|
||||
@ -4,6 +4,8 @@ export fn entry() void {
|
||||
}
|
||||
}
|
||||
|
||||
// attempt to cast enum literal to error
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:9: error: expected type 'error{Hi}', found '@Type(.EnumLiteral)'
|
||||
|
||||
@ -5,7 +5,9 @@ fn SimpleList(comptime L: usize) type {
|
||||
};
|
||||
}
|
||||
|
||||
// attempt to close over comptime variable from outer scope
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:19: error: mutable 'T' not accessible from here
|
||||
// tmp.zig:2:9: note: declared mutable here
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
_ = @Type(.{ .Float = .{ .bits = 17 } });
|
||||
}
|
||||
|
||||
// attempt to create 17 bit float type
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:16: error: 17-bit float unsupported
|
||||
|
||||
@ -7,6 +7,8 @@ export fn entry() void {
|
||||
_ = x;
|
||||
}
|
||||
|
||||
// attempt to negate a non-integer, non-float or non-vector type
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:6:15: error: negation of type 'anyerror!u32'
|
||||
|
||||
@ -9,7 +9,9 @@ export fn entry2() void {
|
||||
bar(&{});
|
||||
}
|
||||
|
||||
// attempt to use 0 bit type in extern fn
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'
|
||||
// tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'
|
||||
|
||||
@ -5,6 +5,8 @@ export fn entry(a: bool, b: bool) i32 {
|
||||
return 5678;
|
||||
}
|
||||
|
||||
// attempted `&&`
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:11: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND
|
||||
|
||||
@ -5,7 +5,9 @@ export fn entry(a: bool, b: bool) i32 {
|
||||
return 5678;
|
||||
}
|
||||
|
||||
// attempted `||` on boolean values
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:9: error: expected error set type, found 'bool'
|
||||
// tmp.zig:2:11: note: `||` merges error sets; `or` performs boolean OR
|
||||
|
||||
@ -3,6 +3,8 @@ export fn entry() void {
|
||||
_ = x;
|
||||
}
|
||||
|
||||
// attempted implicit cast from T to [*]const T
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:30: error: expected type '[*]const bool', found 'bool'
|
||||
|
||||
@ -6,7 +6,9 @@ export fn entry(byte: u8) void {
|
||||
_ = byte;
|
||||
}
|
||||
|
||||
// attempted implicit cast from *const T to *[1]T
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:22: error: expected type '*[1]i32', found '*const i32'
|
||||
// tmp.zig:4:22: note: cast discards const qualifier
|
||||
|
||||
@ -4,6 +4,8 @@ export fn entry() void {
|
||||
_ = x;
|
||||
}
|
||||
|
||||
// attempted implicit cast from *const T to []T
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:23: error: expected type '[]u32', found '*const u32'
|
||||
|
||||
@ -4,6 +4,8 @@ comptime {
|
||||
_ = aligned;
|
||||
}
|
||||
|
||||
// bad @alignCast at comptime
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:35: error: pointer address 0x1 is not aligned to 4 bytes
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
export fn entry() void {
|
||||
var ptr: fn () callconv(.Async) void = func;
|
||||
var bytes: [64]u8 = undefined;
|
||||
_ = @asyncCall(&bytes, {}, ptr, .{});
|
||||
}
|
||||
fn func() callconv(.Async) void {}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=aarch64-linux-none
|
||||
//
|
||||
// tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8'
|
||||
@ -4,6 +4,8 @@ export fn a() void {
|
||||
_ = y;
|
||||
}
|
||||
|
||||
// bad alignment in implicit cast from array pointer to slice
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:30: error: expected type '[]align(16) u8', found '*[10]u8'
|
||||
|
||||
@ -7,7 +7,9 @@ export fn entry2() void {
|
||||
_ = x;
|
||||
}
|
||||
|
||||
// bad alignment type
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:20: error: expected type 'u29', found 'bool'
|
||||
// tmp.zig:6:19: error: fractional component prevents float value 12.340000 from being casted to type 'u29'
|
||||
|
||||
@ -10,6 +10,8 @@ export fn entry() void {
|
||||
_ = Block;
|
||||
}
|
||||
|
||||
// bad identifier in function with struct defined inside function which references local const
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:8:5: error: use of undeclared identifier 'bogus'
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
const bogus = @import("bogus-does-not-exist.zig",);
|
||||
|
||||
// bad import
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:1:23: error: unable to load '${DIR}bogus-does-not-exist.zig': FileNotFound
|
||||
|
||||
@ -19,7 +19,9 @@ fn bar() callconv(.Inline) void {}
|
||||
fn baz1() void {}
|
||||
fn baz2() void {}
|
||||
|
||||
// bad usage of @call
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:21: error: expected tuple or struct, found 'void'
|
||||
// tmp.zig:5:14: error: unable to perform 'never_inline' call at compile-time
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
a &= a;
|
||||
}
|
||||
|
||||
// bin and assign on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
_ = a & a;
|
||||
}
|
||||
|
||||
// bin and on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
_ = ~a;
|
||||
}
|
||||
|
||||
// bin not on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:10: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
a |= a;
|
||||
}
|
||||
|
||||
// bin or assign on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
_ = a | a;
|
||||
}
|
||||
|
||||
// bin or on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
a ^= a;
|
||||
}
|
||||
|
||||
// bin xor assign on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:5: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
_ = a ^ a;
|
||||
}
|
||||
|
||||
// bin xor on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:9: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -4,6 +4,8 @@ var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE -
|
||||
|
||||
export fn entry() usize { return @sizeOf(@TypeOf(block_aligned_stuff)); }
|
||||
|
||||
// binary not on number literal
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:60: error: unable to perform binary not operation on type 'comptime_int'
|
||||
|
||||
@ -3,6 +3,8 @@ export fn entry(byte: u8) void {
|
||||
_ = oops;
|
||||
}
|
||||
|
||||
// @bitCast same size but bit count mismatch
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:25: error: destination type 'u7' has 7 bits but source type 'u8' has 8 bits
|
||||
|
||||
@ -3,6 +3,8 @@ export fn entry() void {
|
||||
_ = y;
|
||||
}
|
||||
|
||||
// bitCast to enum type
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:24: error: cannot cast a value of type 'y'
|
||||
|
||||
@ -3,6 +3,8 @@ export fn entry() void {
|
||||
_ = foo;
|
||||
}
|
||||
|
||||
// @bitCast with different sizes inside an expression
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:25: error: destination type 'u8' has size 1 but source type 'f32' has size 4
|
||||
|
||||
@ -3,6 +3,8 @@ export fn entry() void {
|
||||
_ = x;
|
||||
}
|
||||
|
||||
// bit shifting only works on integer types
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:16: error: bit shifting operation expected integer type, found '*const u8'
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
const x = @import("builtin").bogus;
|
||||
export fn entry() usize { return @sizeOf(@TypeOf(x)); }
|
||||
|
||||
// bogus compile var
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:1:29: error: container 'builtin' has no member called 'bogus'
|
||||
|
||||
@ -4,6 +4,8 @@ fn f(m: []const u8) void {
|
||||
}
|
||||
export fn entry() usize { return @sizeOf(@TypeOf(f)); }
|
||||
|
||||
// bogus method call on slice
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:6: error: no member named 'copy' in '[]const u8'
|
||||
|
||||
@ -3,6 +3,8 @@ comptime {
|
||||
_ = !a;
|
||||
}
|
||||
|
||||
// bool not on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:3:10: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -2,6 +2,8 @@ const x = if (undefined) true else false;
|
||||
|
||||
export fn entry() usize { return @sizeOf(@TypeOf(x)); }
|
||||
|
||||
// branch on undefined value
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:1:15: error: use of undefined value here causes undefined behavior
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
const c = @cImport(@cInclude("bogus.h"));
|
||||
export fn entry() usize { return @sizeOf(@TypeOf(c.bogo)); }
|
||||
|
||||
// @cImport with bogus include
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:1:11: error: C import failed
|
||||
// .h:1:10: note: 'bogus.h' file not found
|
||||
|
||||
@ -16,7 +16,9 @@ export fn entry1() void {
|
||||
baz = bar(42);
|
||||
}
|
||||
|
||||
// call assigned to constant
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:12:14: error: cannot assign to constant
|
||||
// tmp.zig:16:14: error: cannot assign to constant
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
var buf: [10]u8 align(16) = undefined;
|
||||
export fn entry() void {
|
||||
@call(.{ .stack = &buf }, foo, .{});
|
||||
}
|
||||
fn foo() void {}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=wasm32-wasi-none
|
||||
//
|
||||
// tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack
|
||||
@ -0,0 +1,11 @@
|
||||
export fn entry1() callconv(.APCS) void {}
|
||||
export fn entry2() callconv(.AAPCS) void {}
|
||||
export fn entry3() callconv(.AAPCSVFP) void {}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=x86_64-linux-none
|
||||
//
|
||||
// tmp.zig:1:29: error: callconv 'APCS' is only available on ARM, not x86_64
|
||||
// tmp.zig:2:29: error: callconv 'AAPCS' is only available on ARM, not x86_64
|
||||
// tmp.zig:3:29: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64
|
||||
@ -0,0 +1,7 @@
|
||||
export fn entry() callconv(.Interrupt) void {}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=aarch64-linux-none
|
||||
//
|
||||
// tmp.zig:1:28: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64
|
||||
@ -0,0 +1,7 @@
|
||||
export fn entry() callconv(.Signal) void {}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=x86_64-linux-none
|
||||
//
|
||||
// tmp.zig:1:28: error: callconv 'Signal' is only available on AVR, not x86_64
|
||||
@ -0,0 +1,23 @@
|
||||
const F1 = fn () callconv(.Stdcall) void;
|
||||
const F2 = fn () callconv(.Fastcall) void;
|
||||
const F3 = fn () callconv(.Thiscall) void;
|
||||
export fn entry1() void {
|
||||
var a: F1 = undefined;
|
||||
_ = a;
|
||||
}
|
||||
export fn entry2() void {
|
||||
var a: F2 = undefined;
|
||||
_ = a;
|
||||
}
|
||||
export fn entry3() void {
|
||||
var a: F3 = undefined;
|
||||
_ = a;
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=x86_64-linux-none
|
||||
//
|
||||
// tmp.zig:1:27: error: callconv 'Stdcall' is only available on x86, not x86_64
|
||||
// tmp.zig:2:27: error: callconv 'Fastcall' is only available on x86, not x86_64
|
||||
// tmp.zig:3:27: error: callconv 'Thiscall' is only available on x86, not x86_64
|
||||
@ -0,0 +1,11 @@
|
||||
export fn entry1() callconv(.Stdcall) void {}
|
||||
export fn entry2() callconv(.Fastcall) void {}
|
||||
export fn entry3() callconv(.Thiscall) void {}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=x86_64-linux-none
|
||||
//
|
||||
// tmp.zig:1:29: error: callconv 'Stdcall' is only available on x86, not x86_64
|
||||
// tmp.zig:2:29: error: callconv 'Fastcall' is only available on x86, not x86_64
|
||||
// tmp.zig:3:29: error: callconv 'Thiscall' is only available on x86, not x86_64
|
||||
@ -0,0 +1,7 @@
|
||||
export fn entry() callconv(.Vectorcall) void {}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=x86_64-linux-none
|
||||
//
|
||||
// tmp.zig:1:28: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64
|
||||
@ -7,6 +7,8 @@ pub fn main() !void {
|
||||
foos[0](true);
|
||||
}
|
||||
|
||||
// calling a generic function only known at runtime
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:7:9: error: calling a generic function requires compile-time known function value
|
||||
|
||||
@ -3,7 +3,9 @@ export fn entry() void {
|
||||
}
|
||||
fn foo() callconv(.Naked) void { }
|
||||
|
||||
// calling function with naked calling convention
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:5: error: unable to call function with naked calling convention
|
||||
// tmp.zig:4:1: note: declared here
|
||||
|
||||
@ -3,6 +3,8 @@ export fn entry() void {
|
||||
}
|
||||
pub extern fn foo(format: *const u8, ...) void;
|
||||
|
||||
// calling var args extern function, passing array instead of pointer
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:2:16: error: expected type '*const u8', found '[5:0]u8'
|
||||
|
||||
@ -6,6 +6,8 @@ export fn foo() void {
|
||||
}
|
||||
}
|
||||
|
||||
// cannot break out of defer expression
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:13: error: cannot break out of defer expression
|
||||
|
||||
@ -6,6 +6,8 @@ export fn foo() void {
|
||||
}
|
||||
}
|
||||
|
||||
// cannot continue out of defer expression
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:4:13: error: cannot continue out of defer expression
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user