remove stage1 specific compile error tests

This commit is contained in:
Veikka Tuominen 2022-12-07 15:30:18 +02:00
parent f8dcd34775
commit 653c0bae0c
12 changed files with 0 additions and 172 deletions

View File

@ -1,17 +0,0 @@
extern fn foo(ptr: fn(*void) callconv(.C) void) void;
export fn entry() void {
foo(bar);
}
fn bar(x: *void) callconv(.C) void { _ = x; }
export fn entry2() void {
bar(&{});
}
// 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'

View File

@ -1,12 +0,0 @@
fn foo() void {
const node: struct {} = undefined;
const vla_ptr = @ptrCast([*]const u8, &node);
_ = vla_ptr;
}
comptime { foo(); }
// error
// backend=stage1
// target=native
//
// tmp.zig:3:21: error: '*const struct:2:17' and '[*]const u8' do not have the same in-memory representation

View File

@ -1,16 +0,0 @@
const Set1 = error{A, C};
const Set2 = error{B, D};
export fn entry() void {
foo(Set1.A);
}
fn foo(x: Set1) void {
if (x == Set2.B) {
}
}
// error
// backend=stage1
// target=native
//
// tmp.zig:7:11: error: error sets 'Set1' and 'Set2' have no common errors

View File

@ -1,11 +0,0 @@
comptime {
var c_ptr: [*c]u8 = undefined;
var zig_ptr: *u8 = c_ptr;
_ = zig_ptr;
}
// error
// backend=stage1
// target=native
//
// tmp.zig:3:24: error: use of undefined value here causes undefined behavior

View File

@ -1,27 +0,0 @@
export fn foo1() void {
const a: *[1]u8 = undefined;
var b: []u8 = a;
_ = b;
}
export fn foo2() void {
comptime {
var a: *[1]u8 = undefined;
var b: []u8 = a;
_ = b;
}
}
export fn foo3() void {
comptime {
const a: *[1]u8 = undefined;
var b: []u8 = a;
_ = b;
}
}
// error
// backend=stage1
// target=native
//
// tmp.zig:3:19: error: use of undefined value here causes undefined behavior
// tmp.zig:9:23: error: use of undefined value here causes undefined behavior
// tmp.zig:16:23: error: use of undefined value here causes undefined behavior

View File

@ -1,9 +0,0 @@
export fn entry() bool {
return @ptrToInt(&{}) == @ptrToInt(&{});
}
// error
// backend=stage1
// target=native
//
// tmp.zig:2:23: error: pointer to size 0 type has no address

View File

@ -1,11 +0,0 @@
export fn entry() void {
var pointer: ?*u0 = null;
var x = @ptrToInt(pointer);
_ = x;
}
// error
// backend=stage1
// target=native
//
// tmp.zig:3:23: error: pointer to size 0 type has no address

View File

@ -1,18 +0,0 @@
export fn entry() void {
_ = @Type(.{ .Pointer = .{
.size = .One,
.is_const = false,
.is_volatile = false,
.alignment = 1,
.address_space = .gs,
.child = u8,
.is_allowzero = false,
.sentinel = null,
}});
}
// error
// backend=stage1
// target=native
//
// tmp.zig:2:16: error: address space 'gs' not available in stage 1 compiler, must be .generic

View File

@ -1,11 +0,0 @@
const builtin = @import("std").builtin;
var globalTypeInfo : builtin.Type = undefined;
export fn entry() void {
_ = @Type(globalTypeInfo);
}
// error
// backend=stage1
// target=native
//
// tmp.zig:4:15: error: unable to evaluate constant expression

View File

@ -1,10 +0,0 @@
var buf: *[1]u8 = undefined;
export fn entry() void {
_ = buf[0..1];
}
// error
// backend=stage1
// target=native
//
// tmp.zig:3:12: error: non-zero length slice of undefined pointer

View File

@ -1,17 +0,0 @@
export fn entry() void {
Test(i32);
}
fn Test(comptime T: type) void {
const x = switch (T) {
[]u8 => |x| x,
i32 => |x| x,
else => unreachable,
};
_ = x;
}
// error
// backend=stage1
// target=native
//
// tmp.zig:7:17: error: switch on type 'type' provides no expression parameter

View File

@ -1,13 +0,0 @@
const Cmd = struct {
exec: fn () void,
};
export fn entry() void {
const command = Cmd{ .exec = undefined };
command.exec();
}
// error
// backend=stage1
// target=native
//
// tmp.zig:6:12: error: use of undefined value here causes undefined behavior