| ... | @@ -11090,6 +11090,7 @@ static IrInstruction *ir_analyze_ptr_to_array(IrAnalyze *ira, IrInstruction *sou | ... | @@ -11090,6 +11090,7 @@ static IrInstruction *ir_analyze_ptr_to_array(IrAnalyze *ira, IrInstruction *sou |
| 11090 | Error err; | 11090 | Error err; |
| 11091 | if ((err = type_resolve(ira->codegen, target->value.type->data.pointer.child_type, ResolveStatusAlignmentKnown))) | 11091 | if ((err = type_resolve(ira->codegen, target->value.type->data.pointer.child_type, ResolveStatusAlignmentKnown))) |
| 11092 | return ira->codegen->invalid_instruction; | 11092 | return ira->codegen->invalid_instruction; |
| | 11093 | assert((wanted_type->data.pointer.is_const && target->value.type->data.pointer.is_const) || !target->value.type->data.pointer.is_const); |
| 11093 | wanted_type = adjust_ptr_align(ira->codegen, wanted_type, get_ptr_align(ira->codegen, target->value.type)); | 11094 | wanted_type = adjust_ptr_align(ira->codegen, wanted_type, get_ptr_align(ira->codegen, target->value.type)); |
| 11094 | ZigType *array_type = wanted_type->data.pointer.child_type; | 11095 | ZigType *array_type = wanted_type->data.pointer.child_type; |
| 11095 | assert(array_type->id == ZigTypeIdArray); | 11096 | assert(array_type->id == ZigTypeIdArray); |
| ... | @@ -11651,7 +11652,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -11651,7 +11652,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 11651 | if (array_type->id == ZigTypeIdArray && array_type->data.array.len == 1 && | 11652 | if (array_type->id == ZigTypeIdArray && array_type->data.array.len == 1 && |
| 11652 | types_match_const_cast_only(ira, array_type->data.array.child_type, | 11653 | types_match_const_cast_only(ira, array_type->data.array.child_type, |
| 11653 | actual_type->data.pointer.child_type, source_node, | 11654 | actual_type->data.pointer.child_type, source_node, |
| 11654 | !wanted_type->data.pointer.is_const).id == ConstCastResultIdOk) | 11655 | !wanted_type->data.pointer.is_const).id == ConstCastResultIdOk && |
| | 11656 | // This should be the job of `types_match_const_cast_only` |
| | 11657 | // but `types_match_const_cast_only` only gets info for child_types |
| | 11658 | ((wanted_type->data.pointer.is_const && actual_type->data.pointer.is_const) || |
| | 11659 | !actual_type->data.pointer.is_const)) |
| 11655 | { | 11660 | { |
| 11656 | if ((err = type_resolve(ira->codegen, wanted_type->data.pointer.child_type, | 11661 | if ((err = type_resolve(ira->codegen, wanted_type->data.pointer.child_type, |
| 11657 | ResolveStatusAlignmentKnown))) | 11662 | ResolveStatusAlignmentKnown))) |