stage1: Validate the specified cc for lazy fn types

Closes #7337
This commit is contained in:
LemonBoy
2020-12-08 18:38:50 +01:00
committed by Andrew Kelley
parent 8f646daed6
commit 8ac711596d
4 changed files with 31 additions and 3 deletions

View File

@@ -94,6 +94,26 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
};
break :x tc;
});
cases.addCase(x: {
var tc = cases.create("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform",
\\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; }
\\export fn entry2() void { var a: F2 = undefined; }
\\export fn entry3() void { var a: F3 = undefined; }
, &[_][]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",
});
tc.target = std.zig.CrossTarget{
.cpu_arch = .x86_64,
.os_tag = .linux,
.abi = .none,
};
break :x tc;
});
cases.addCase(x: {
var tc = cases.create("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform",