| ... | ... | @@ -10838,8 +10838,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10838 | 10838 | { |
| 10839 | 10839 | ZigType *slice_ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry; |
| 10840 | 10840 | assert(slice_ptr_type->id == ZigTypeIdPointer); |
| 10841 | | if (types_match_const_cast_only(ira, slice_ptr_type->data.pointer.child_type, |
| 10842 | | actual_type->data.pointer.child_type->data.array.child_type, source_node, |
| 10841 | ZigType *array_type = actual_type->data.pointer.child_type; |
| 10842 | bool const_ok = (slice_ptr_type->data.pointer.is_const || array_type->data.array.len == 0 |
| 10843 | || !actual_type->data.pointer.is_const); |
| 10844 | if (const_ok && types_match_const_cast_only(ira, slice_ptr_type->data.pointer.child_type, |
| 10845 | array_type->data.array.child_type, source_node, |
| 10843 | 10846 | !slice_ptr_type->data.pointer.is_const).id == ConstCastResultIdOk) |
| 10844 | 10847 | { |
| 10845 | 10848 | return ir_resolve_ptr_of_array_to_slice(ira, source_instr, value, wanted_type); |