| 1 | export fn foo() void { |
| 2 | var a: f32 = 2; |
| 3 | _ = &a; |
| 4 | _ = @as(comptime_int, @intFromFloat(a)); |
| 5 | } |
| 6 | export fn bar() void { |
| 7 | var a: u32 = 2; |
| 8 | _ = &a; |
| 9 | _ = @as(comptime_float, @floatFromInt(a)); |
| 10 | } |
| 11 | |
| 12 | // error |
| 13 | // |
| 14 | // :4:41: error: unable to resolve comptime value |
| 15 | // :4:41: note: value casted to 'comptime_int' must be comptime-known |
| 16 | // :9:43: error: unable to resolve comptime value |
| 17 | // :9:43: note: value casted to 'comptime_float' must be comptime-known |