diff options
| author | gingerBill <bill@gingerbill.org> | 2020-04-04 21:23:11 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-04-04 21:23:11 +0100 |
| commit | 5e706bab56eb28023d27623e0d33c4b5e06b5781 (patch) | |
| tree | 1d114559c0a9a50f61cca67d63724021b994fd58 /src/ir.cpp | |
| parent | b362ce9a22e7eb751c281daf6e78bd8f473a799e (diff) | |
Fix typeid comparison bug in `ir.cpp`
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 40b83c048..2b6917d0d 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -7046,13 +7046,18 @@ irValue *ir_build_expr(irProcedure *proc, Ast *expr) { } irValue *ir_build_expr_internal(irProcedure *proc, Ast *expr) { + Ast *original_expr = expr; expr = unparen_expr(expr); // ir_push_debug_location(proc->module, expr, proc->debug_scope); // defer (ir_pop_debug_location(proc->module)); TypeAndValue tv = type_and_value_of_expr(expr); GB_ASSERT(tv.mode != Addressing_Invalid); - GB_ASSERT(tv.mode != Addressing_Type); + if (tv.mode == Addressing_Type) { + // HACK TODO(bill): This is hack but it should be safe in virtually all cases + irValue *v = ir_typeid(proc->module, tv.type); + return ir_emit_conv(proc, v, t_typeid); + } if (tv.value.kind != ExactValue_Invalid) { // NOTE(bill): Edge case |