diff options
| author | Carl Åstholm <carl@astholm.se> | 2024-02-18 13:17:48 +0100 |
|---|---|---|
| committer | Carl Åstholm <carl@astholm.se> | 2024-04-07 15:07:55 +0200 |
| commit | 9181ecd95133b42da75c6c5e8456830d93a9f7a9 (patch) | |
| tree | 5215d467bf8cdefc366efdfce018e7978361b13d /src | |
| parent | 129de47a71b954b1118ce188f7032ad726491f53 (diff) | |
| download | zig-9181ecd95133b42da75c6c5e8456830d93a9f7a9.tar.gz zig-9181ecd95133b42da75c6c5e8456830d93a9f7a9.zip | |
Sema: fix runtime call of inline fn with comptime-known comptime-only ret type
Diffstat (limited to 'src')
| -rw-r--r-- | src/Sema.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 39d687c18a..fa55876cc3 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -7525,10 +7525,12 @@ fn analyzeCall( var is_generic_call = func_ty_info.is_generic; var is_comptime_call = block.is_comptime or modifier == .compile_time; + var is_inline_call = is_comptime_call or modifier == .always_inline or func_ty_info.cc == .Inline; var comptime_reason: ?*const Block.ComptimeReason = null; - if (!is_comptime_call) { + if (!is_inline_call and !is_comptime_call) { if (sema.typeRequiresComptime(Type.fromInterned(func_ty_info.return_type))) |ct| { is_comptime_call = ct; + is_inline_call = ct; if (ct) { comptime_reason = &.{ .comptime_ret_ty = .{ .block = block, @@ -7542,8 +7544,6 @@ fn analyzeCall( else => |e| return e, } } - var is_inline_call = is_comptime_call or modifier == .always_inline or - func_ty_info.cc == .Inline; if (sema.func_is_naked and !is_inline_call and !is_comptime_call) { const msg = msg: { |
