File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ test "int" {
144144}
145145
146146test "float" {
147- @setEvalBranchQuota (2000 );
147+ @setEvalBranchQuota (3000 );
148148
149149 // normal -> normal
150150 try expect (nextAfter (f16 , 0x1.234p0 , 2.0 ) == 0x1.238p0 );
Original file line number Diff line number Diff line change @@ -7423,10 +7423,12 @@ fn analyzeCall(
74237423
74247424 var is_generic_call = func_ty_info.is_generic;
74257425 var is_comptime_call = block.is_comptime or modifier == .compile_time;
7426+ var is_inline_call = is_comptime_call or modifier == .always_inline or func_ty_info.cc == .Inline;
74267427 var comptime_reason: ?*const Block.ComptimeReason = null;
7427- if (!is_comptime_call) {
7428+ if (!is_inline_call and ! is_comptime_call) {
74287429 if (sema.typeRequiresComptime(Type.fromInterned(func_ty_info.return_type))) |ct| {
74297430 is_comptime_call = ct;
7431+ is_inline_call = ct;
74307432 if (ct) {
74317433 comptime_reason = &.{ .comptime_ret_ty = .{
74327434 .block = block,
@@ -7440,8 +7442,6 @@ fn analyzeCall(
74407442 else => |e| return e,
74417443 }
74427444 }
7443- var is_inline_call = is_comptime_call or modifier == .always_inline or
7444- func_ty_info.cc == .Inline;
74457445
74467446 if (sema.func_is_naked and !is_inline_call and !is_comptime_call) {
74477447 const msg = msg: {
Original file line number Diff line number Diff line change @@ -605,3 +605,17 @@ test "comptime parameters don't have to be marked comptime if only called at com
605605 };
606606 comptime std .debug .assert (S .foo (5 , 6 ) == 11 );
607607}
608+
609+ test "inline function with comptime-known comptime-only return type called at runtime" {
610+ const S = struct {
611+ inline fn foo (x : * i32 , y : * const i32 ) type {
612+ x .* = y .* ;
613+ return f32 ;
614+ }
615+ };
616+ var a : i32 = 0 ;
617+ const b : i32 = 111 ;
618+ const T = S .foo (& a , & b );
619+ try expectEqual (111 , a );
620+ try expectEqual (f32 , T );
621+ }
You can’t perform that action at this time.
0 commit comments