| ... | ... | @@ -17188,11 +17188,18 @@ static IrInstruction *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstru |
| 17188 | 17188 | assert(target_value_ptr->value.type->id == ZigTypeIdPointer); |
| 17189 | 17189 | ZigType *target_type = target_value_ptr->value.type->data.pointer.child_type; |
| 17190 | 17190 | if (target_type->id == ZigTypeIdUnion) { |
| 17191 | | ConstExprValue *prong_val = ir_resolve_const(ira, prong_value, UndefBad); |
| 17191 | ZigType *enum_type = target_type->data.unionation.tag_type; |
| 17192 | assert(enum_type != nullptr); |
| 17193 | assert(enum_type->id == ZigTypeIdEnum); |
| 17194 | |
| 17195 | IrInstruction *casted_prong_value = ir_implicit_cast(ira, prong_value, enum_type); |
| 17196 | if (type_is_invalid(casted_prong_value->value.type)) |
| 17197 | return ira->codegen->invalid_instruction; |
| 17198 | |
| 17199 | ConstExprValue *prong_val = ir_resolve_const(ira, casted_prong_value, UndefBad); |
| 17192 | 17200 | if (!prong_val) |
| 17193 | 17201 | return ira->codegen->invalid_instruction; |
| 17194 | 17202 | |
| 17195 | | assert(prong_value->value.type->id == ZigTypeIdEnum); |
| 17196 | 17203 | TypeUnionField *field = find_union_field_by_tag(target_type, &prong_val->data.x_enum_tag); |
| 17197 | 17204 | |
| 17198 | 17205 | if (instr_is_comptime(target_value_ptr)) { |