Skip to content

Commit

Permalink
Sema: fix comptime only types being allowed on extern functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexu committed Oct 5, 2022
1 parent ba4aa12 commit badbf04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Sema.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7970,7 +7970,7 @@ fn funcCommon(
i,
&is_generic,
cc_workaround,
has_body,
has_body or is_extern,
) catch |err| switch (err) {
error.NeededSourceLocation => {
const decl = sema.mod.declPtr(block.src_decl);
Expand All @@ -7982,7 +7982,7 @@ fn funcCommon(
i,
&is_generic,
cc_workaround,
has_body,
has_body or is_extern,
);
return error.AnalysisFail;
},
Expand Down
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

0 comments on commit badbf04

Please sign in to comment.