| ... | @@ -11601,8 +11601,10 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -11601,8 +11601,10 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 11601 | | 11601 | |
| 11602 | TypeEnumField *field = find_enum_type_field(wanted_type, value->value.data.x_enum_literal); | 11602 | TypeEnumField *field = find_enum_type_field(wanted_type, value->value.data.x_enum_literal); |
| 11603 | if (field == nullptr) { | 11603 | if (field == nullptr) { |
| 11604 | ir_add_error(ira, source_instr, buf_sprintf("enum '%s' has no field named '%s'", | 11604 | ErrorMsg *msg = ir_add_error(ira, source_instr, buf_sprintf("enum '%s' has no field named '%s'", |
| 11605 | buf_ptr(&wanted_type->name), buf_ptr(value->value.data.x_enum_literal))); | 11605 | buf_ptr(&wanted_type->name), buf_ptr(value->value.data.x_enum_literal))); |
| | 11606 | add_error_note(ira->codegen, msg, wanted_type->data.enumeration.decl_node, |
| | 11607 | buf_sprintf("'%s' declared here", buf_ptr(&wanted_type->name))); |
| 11606 | return ira->codegen->invalid_instruction; | 11608 | return ira->codegen->invalid_instruction; |
| 11607 | } | 11609 | } |
| 11608 | IrInstruction *result = ir_const(ira, source_instr, wanted_type); | 11610 | IrInstruction *result = ir_const(ira, source_instr, wanted_type); |