forked from ziglang/zig
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sema: fix comptime only types being allowed on extern functions
Closes ziglang#13022
- Loading branch information
Showing
2 changed files
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
test/cases/compile_errors/comptime_only_params_not_allowed_on_extern_fns.zig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
pub extern fn signal(handler: fn (c_int, c_int) callconv(.C) void) void; | ||
fn interruptFn(_: c_int, _: c_int) callconv(.C) void {} | ||
|
||
pub export fn entry() void { | ||
_ = signal(interruptFn); | ||
} | ||
|
||
// error | ||
// backend=stage2 | ||
// target=native | ||
// | ||
// :1:22: error: parameter of type 'fn(c_int, c_int) callconv(.C) void' must be declared comptime |