mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 00:08:56 +00:00
Sema: fix function type callconv inference
This commit is contained in:
parent
6d44c0a16c
commit
50a6b0f3ac
@ -6654,7 +6654,11 @@ fn zirFunc(
|
||||
src_locs = sema.code.extraData(Zir.Inst.Func.SrcLocs, extra_index).data;
|
||||
}
|
||||
|
||||
const cc: std.builtin.CallingConvention = if (sema.owner_decl.is_exported)
|
||||
// If this instruction has a body it means it's the type of the `owner_decl`
|
||||
// otherwise it's a function type without a `callconv` attribute and should
|
||||
// never be `.C`.
|
||||
// NOTE: revisit when doing #1717
|
||||
const cc: std.builtin.CallingConvention = if (sema.owner_decl.is_exported and has_body)
|
||||
.C
|
||||
else
|
||||
.Unspecified;
|
||||
|
||||
@ -23,9 +23,9 @@ pub export fn entry3() void {
|
||||
// error
|
||||
// backend=stage2,llvm
|
||||
//
|
||||
// :6:33: error: values of type '[2]fn() callconv(.C) void' must be comptime known, but index value is runtime known
|
||||
// :6:33: note: use '*const fn() callconv(.C) void' for a function pointer type
|
||||
// :13:33: error: values of type '[2]fn() callconv(.C) void' must be comptime known, but index value is runtime known
|
||||
// :13:33: note: use '*const fn() callconv(.C) void' for a function pointer type
|
||||
// :19:33: error: values of type '[2]fn() callconv(.C) void' must be comptime known, but index value is runtime known
|
||||
// :19:33: note: use '*const fn() callconv(.C) void' for a function pointer type
|
||||
// :6:5: error: values of type '[2]fn() void' must be comptime known, but index value is runtime known
|
||||
// :6:5: note: use '*const fn() void' for a function pointer type
|
||||
// :13:5: error: values of type '[2]fn() void' must be comptime known, but index value is runtime known
|
||||
// :13:5: note: use '*const fn() void' for a function pointer type
|
||||
// :19:5: error: values of type '[2]fn() void' must be comptime known, but index value is runtime known
|
||||
// :19:5: note: use '*const fn() void' for a function pointer type
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user