@@ -21126,17 +21126,19 @@ static IrInstruction *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira, IrI
21126
21126
ConstExprValue *ptr_val = ir_resolve_const(ira, base_ptr, UndefBad);
21127
21127
if (!ptr_val)
21128
21128
return ira->codegen->invalid_instruction;
21129
- ConstExprValue *err_union_val = const_ptr_pointee(ira, ira->codegen, ptr_val, instruction->base.source_node);
21130
- if (err_union_val == nullptr)
21131
- return ira->codegen->invalid_instruction;
21132
- if (err_union_val->special != ConstValSpecialRuntime) {
21133
- ErrorTableEntry *err = err_union_val->data.x_err_union.error_set->data.x_err_set;
21134
- assert(err);
21129
+ if (ptr_val->data.x_ptr.mut != ConstPtrMutRuntimeVar) {
21130
+ ConstExprValue *err_union_val = const_ptr_pointee(ira, ira->codegen, ptr_val, instruction->base.source_node);
21131
+ if (err_union_val == nullptr)
21132
+ return ira->codegen->invalid_instruction;
21133
+ if (err_union_val->special != ConstValSpecialRuntime) {
21134
+ ErrorTableEntry *err = err_union_val->data.x_err_union.error_set->data.x_err_set;
21135
+ assert(err);
21135
21136
21136
- IrInstruction *result = ir_const(ira, &instruction->base,
21137
- type_entry->data.error_union.err_set_type);
21138
- result->value.data.x_err_set = err;
21139
- return result;
21137
+ IrInstruction *result = ir_const(ira, &instruction->base,
21138
+ type_entry->data.error_union.err_set_type);
21139
+ result->value.data.x_err_set = err;
21140
+ return result;
21141
+ }
21140
21142
}
21141
21143
}
21142
21144
@@ -21179,21 +21181,23 @@ static IrInstruction *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira,
21179
21181
ConstExprValue *ptr_val = ir_resolve_const(ira, value, UndefBad);
21180
21182
if (!ptr_val)
21181
21183
return ira->codegen->invalid_instruction;
21182
- ConstExprValue *err_union_val = const_ptr_pointee(ira, ira->codegen, ptr_val, instruction->base.source_node);
21183
- if (err_union_val == nullptr)
21184
- return ira->codegen->invalid_instruction;
21185
- if (err_union_val->special != ConstValSpecialRuntime) {
21186
- ErrorTableEntry *err = err_union_val->data.x_err_union.error_set->data.x_err_set;
21187
- if (err != nullptr) {
21188
- ir_add_error(ira, &instruction->base,
21189
- buf_sprintf("caught unexpected error '%s'", buf_ptr(&err->name)));
21184
+ if (ptr_val->data.x_ptr.mut != ConstPtrMutRuntimeVar) {
21185
+ ConstExprValue *err_union_val = const_ptr_pointee(ira, ira->codegen, ptr_val, instruction->base.source_node);
21186
+ if (err_union_val == nullptr)
21190
21187
return ira->codegen->invalid_instruction;
21191
- }
21188
+ if (err_union_val->special != ConstValSpecialRuntime) {
21189
+ ErrorTableEntry *err = err_union_val->data.x_err_union.error_set->data.x_err_set;
21190
+ if (err != nullptr) {
21191
+ ir_add_error(ira, &instruction->base,
21192
+ buf_sprintf("caught unexpected error '%s'", buf_ptr(&err->name)));
21193
+ return ira->codegen->invalid_instruction;
21194
+ }
21192
21195
21193
- IrInstruction *result = ir_const(ira, &instruction->base, result_type);
21194
- result->value.data.x_ptr.special = ConstPtrSpecialRef;
21195
- result->value.data.x_ptr.data.ref.pointee = err_union_val->data.x_err_union.payload;
21196
- return result;
21196
+ IrInstruction *result = ir_const(ira, &instruction->base, result_type);
21197
+ result->value.data.x_ptr.special = ConstPtrSpecialRef;
21198
+ result->value.data.x_ptr.data.ref.pointee = err_union_val->data.x_err_union.payload;
21199
+ return result;
21200
+ }
21197
21201
}
21198
21202
}
21199
21203
0 commit comments