| ... | @@ -9682,8 +9682,12 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc | ... | @@ -9682,8 +9682,12 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 9682 | if (type_is_invalid(elem_index->value.type)) | 9682 | if (type_is_invalid(elem_index->value.type)) |
| 9683 | return ira->codegen->builtin_types.entry_invalid; | 9683 | return ira->codegen->builtin_types.entry_invalid; |
| 9684 | | 9684 | |
| 9685 | // This will be a pointer type because elem ptr IR instruction operates on a pointer to a thing. | | |
| 9686 | TypeTableEntry *ptr_type = array_ptr->value.type; | 9685 | TypeTableEntry *ptr_type = array_ptr->value.type; |
| | 9686 | if (ptr_type->id == TypeTableEntryIdMetaType) { |
| | 9687 | ir_add_error(ira, &elem_ptr_instruction->base, |
| | 9688 | buf_sprintf("array access of non-array type '%s'", buf_ptr(&ptr_type->name))); |
| | 9689 | return ira->codegen->builtin_types.entry_invalid; |
| | 9690 | } |
| 9687 | assert(ptr_type->id == TypeTableEntryIdPointer); | 9691 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| 9688 | | 9692 | |
| 9689 | TypeTableEntry *array_type = ptr_type->data.pointer.child_type; | 9693 | TypeTableEntry *array_type = ptr_type->data.pointer.child_type; |