| ... | ... | @@ -770,3 +770,15 @@ test "return undefined pointer from function, directly and by expired local" { |
| 770 | 770 | const bad_ptr_2 = S.returnStackPointer(); |
| 771 | 771 | _ = bad_ptr_2; // dereferencing this would be illegal behavior |
| 772 | 772 | } |
| 773 | |
| 774 | test "a function that works at comptime but not runtime" { |
| 775 | const a = comptime testComptimeOnlyFn(1, 1); |
| 776 | try expect(a[0] == 1); |
| 777 | try expect(a[1] == 2); |
| 778 | } |
| 779 | |
| 780 | fn testComptimeOnlyFn(x: u32, y: u32) [2]u8 { |
| 781 | const xa: [x]u8 = .{1}; |
| 782 | const ya: [y]u8 = .{2}; |
| 783 | return xa ++ ya; |
| 784 | } |