Sema: emit error when pointer to extern function is called

This commit is contained in:
Bogdan Romanyuk
2023-11-06 18:26:28 +03:00
committed by GitHub
parent e74ced21b7
commit 62e67a2b56
2 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
const x = @extern(*const fn() callconv(.C) void, .{ .name = "foo" });
pub fn entry0() void {
comptime x();
}
pub fn entry1() void {
@call(.always_inline, x, .{});
}
// error
// backend=stage2
// target=native
//
// :4:15: error: comptime call of extern function pointer
// :8:5: error: inline call of extern function pointer