diff options
| author | Vexu <git@vexu.eu> | 2020-07-18 10:22:15 +0300 |
|---|---|---|
| committer | Vexu <git@vexu.eu> | 2020-07-18 10:22:15 +0300 |
| commit | 78962eeeda07d613ebdfd239082268a6702c19db (patch) | |
| tree | ecd9d8f2503b69cd49cce34edf5e827c68ba5767 /src | |
| parent | 39915ae08668884f51071feb4b1132b1903f0abb (diff) | |
| download | zig-78962eeeda07d613ebdfd239082268a6702c19db.tar.gz zig-78962eeeda07d613ebdfd239082268a6702c19db.zip | |
fix floatCast type check regression
Closes #5900
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index d027badac1..88e111ccb5 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -26739,6 +26739,12 @@ static IrInstGen *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstSrcFlo } } + if (target->value->type->id != ZigTypeIdFloat) { + ir_add_error(ira, &instruction->target->base, buf_sprintf("expected float type, found '%s'", + buf_ptr(&target->value->type->name))); + return ira->codegen->invalid_inst_gen; + } + if (instr_is_comptime(target) || dest_type->id == ZigTypeIdComptimeFloat) { ZigValue *val = ir_resolve_const(ira, target, UndefBad); if (val == nullptr) |
