@@ -19591,6 +19591,12 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,
19591
19591
if (type_is_invalid(result_loc->value->type) || result_loc->value->type->id == ZigTypeIdUnreachable) {
19592
19592
return result_loc;
19593
19593
}
19594
+ IrInstGen *dummy_value = ir_const(ira, source_instr, impl_fn_type_id->return_type);
19595
+ dummy_value->value->special = ConstValSpecialRuntime;
19596
+ IrInstGen *dummy_result = ir_implicit_cast2(ira, source_instr,
19597
+ dummy_value, result_loc->value->type->data.pointer.child_type);
19598
+ if (type_is_invalid(dummy_result->value->type))
19599
+ return ira->codegen->invalid_inst_gen;
19594
19600
ZigType *res_child_type = result_loc->value->type->data.pointer.child_type;
19595
19601
if (res_child_type == ira->codegen->builtin_types.entry_var) {
19596
19602
res_child_type = impl_fn_type_id->return_type;
@@ -19723,6 +19729,12 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,
19723
19729
if (type_is_invalid(result_loc->value->type) || result_loc->value->type->id == ZigTypeIdUnreachable) {
19724
19730
return result_loc;
19725
19731
}
19732
+ IrInstGen *dummy_value = ir_const(ira, source_instr, return_type);
19733
+ dummy_value->value->special = ConstValSpecialRuntime;
19734
+ IrInstGen *dummy_result = ir_implicit_cast2(ira, source_instr,
19735
+ dummy_value, result_loc->value->type->data.pointer.child_type);
19736
+ if (type_is_invalid(dummy_result->value->type))
19737
+ return ira->codegen->invalid_inst_gen;
19726
19738
ZigType *res_child_type = result_loc->value->type->data.pointer.child_type;
19727
19739
if (res_child_type == ira->codegen->builtin_types.entry_var) {
19728
19740
res_child_type = return_type;
0 commit comments