| ... | ... | @@ -267,6 +267,7 @@ static IrInstGen *ir_analyze_inferred_field_ptr(IrAnalyze *ira, Buf *field_name, |
| 267 | 267 | static ResultLoc *no_result_loc(void); |
| 268 | 268 | static IrInstGen *ir_analyze_test_non_null(IrAnalyze *ira, IrInst *source_inst, IrInstGen *value); |
| 269 | 269 | static IrInstGen *ir_error_dependency_loop(IrAnalyze *ira, IrInst *source_instr); |
| 270 | static IrInstGen *ir_const_undef(IrAnalyze *ira, IrInst *source_instruction, ZigType *ty); |
| 270 | 271 | |
| 271 | 272 | static void destroy_instruction_src(IrInstSrc *inst) { |
| 272 | 273 | switch (inst->id) { |
| ... | ... | @@ -12784,13 +12785,19 @@ static IrInstGen *ir_resolve_ptr_of_array_to_unknown_len_ptr(IrAnalyze *ira, IrI |
| 12784 | 12785 | wanted_type = adjust_ptr_align(ira->codegen, wanted_type, get_ptr_align(ira->codegen, value->value->type)); |
| 12785 | 12786 | |
| 12786 | 12787 | if (instr_is_comptime(value)) { |
| 12787 | | ZigValue *pointee = const_ptr_pointee(ira, ira->codegen, value->value, source_instr->source_node); |
| 12788 | ZigValue *val = ir_resolve_const(ira, value, UndefOk); |
| 12789 | if (val == nullptr) |
| 12790 | return ira->codegen->invalid_inst_gen; |
| 12791 | if (val->special == ConstValSpecialUndef) |
| 12792 | return ir_const_undef(ira, source_instr, wanted_type); |
| 12793 | |
| 12794 | ZigValue *pointee = const_ptr_pointee(ira, ira->codegen, val, source_instr->source_node); |
| 12788 | 12795 | if (pointee == nullptr) |
| 12789 | 12796 | return ira->codegen->invalid_inst_gen; |
| 12790 | 12797 | if (pointee->special != ConstValSpecialRuntime) { |
| 12791 | 12798 | IrInstGen *result = ir_const(ira, source_instr, wanted_type); |
| 12792 | 12799 | result->value->data.x_ptr.special = ConstPtrSpecialBaseArray; |
| 12793 | | result->value->data.x_ptr.mut = value->value->data.x_ptr.mut; |
| 12800 | result->value->data.x_ptr.mut = val->data.x_ptr.mut; |
| 12794 | 12801 | result->value->data.x_ptr.data.base_array.array_val = pointee; |
| 12795 | 12802 | result->value->data.x_ptr.data.base_array.elem_index = 0; |
| 12796 | 12803 | return result; |