| ... | ... | @@ -589,3 +589,19 @@ comptime { |
| 589 | 589 | // should override the result of the previous analysis. |
| 590 | 590 | for (0..2) |_| _ = fn (void) void; |
| 591 | 591 | } |
| 592 | |
| 593 | test "generic parameter resolves to comptime-only type but is not marked comptime" { |
| 594 | const S = struct { |
| 595 | fn foo(comptime T: type, rt_false: bool, func: fn (T) void) T { |
| 596 | if (rt_false) _ = foo(T, rt_false, func); |
| 597 | return 123; |
| 598 | } |
| 599 | fn bar(_: u8) void {} |
| 600 | }; |
| 601 | |
| 602 | const rt_result = S.foo(u8, false, S.bar); |
| 603 | try expect(rt_result == 123); |
| 604 | |
| 605 | const ct_result = comptime S.foo(u8, false, S.bar); |
| 606 | comptime std.debug.assert(ct_result == 123); |
| 607 | } |