zig/doc/langref/test_failed_into_to_float_coercion.zig
Jay Petacat 464fcac802
Sema: Allow small integer types to coerce to floats
If the float can store all possible values of the integer without
rounding, coercion is allowed. The integer's precision must be less than
or equal to the float's significand precision.

Closes #18614
2025-11-29 13:18:19 -07:00

8 lines
161 B
Zig

test "integer type is too large for implicit cast to float" {
var int: u25 = 123;
_ = ∫
const float: f32 = int;
_ = float;
}
// test_error=