mirror of
https://github.com/ziglang/zig.git
synced 2026-01-04 12:33:19 +00:00
Sema: fix comptime @floatCast downcast
This commit is contained in:
parent
58943fc627
commit
5626bb45d2
@ -7236,8 +7236,8 @@ fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
|
||||
),
|
||||
}
|
||||
|
||||
if (try sema.isComptimeKnown(block, operand_src, operand)) {
|
||||
return sema.coerce(block, dest_ty, operand, operand_src);
|
||||
if (try sema.resolveMaybeUndefVal(block, operand_src, operand)) |operand_val| {
|
||||
return sema.addConstant(dest_ty, try operand_val.floatCast(sema.arena, dest_ty, target));
|
||||
}
|
||||
if (dest_is_comptime_float) {
|
||||
return sema.fail(block, src, "unable to cast runtime value to 'comptime_float'", .{});
|
||||
|
||||
@ -630,7 +630,9 @@ test "vector casts" {
|
||||
}
|
||||
|
||||
test "@floatCast cast down" {
|
||||
if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
|
||||
{
|
||||
var double: f64 = 0.001534;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user