Sema: fix @extern error on function pointer

This commit is contained in:
Bogdan Romanyuk
2023-10-16 04:30:39 +03:00
committed by GitHub
parent fd6b3db342
commit ebde525cce
2 changed files with 21 additions and 4 deletions

View File

@@ -1,7 +1,11 @@
const x = @extern(*comptime_int, .{ .name = "foo" });
const y = @extern(*fn (u8) u8, .{ .name = "bar" });
pub export fn entry() void {
_ = x;
}
pub export fn entry2() void {
_ = y;
}
// error
// backend=stage2
@@ -9,3 +13,6 @@ pub export fn entry() void {
//
// :1:19: error: extern symbol cannot have type '*comptime_int'
// :1:19: note: pointer to comptime-only type 'comptime_int'
// :2:19: error: extern symbol cannot have type '*fn (u8) u8'
// :2:19: note: pointer to extern function must be 'const'
// :2:19: note: extern function must specify calling convention