ir: fix handling of OnePossibleValueInvalid

this is the poison value which means a compile error has
already been reported
This commit is contained in:
Andrew Kelley 2019-03-11 11:09:15 -04:00
parent bcbb2650c5
commit 1d5e349a52
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9

View File

@ -10562,8 +10562,9 @@ static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *so
return ira->codegen->invalid_instruction;
switch (type_has_one_possible_value(ira->codegen, union_field->type_entry)) {
case OnePossibleValueNo:
case OnePossibleValueInvalid: {
case OnePossibleValueInvalid:
return ira->codegen->invalid_instruction;
case OnePossibleValueNo: {
AstNode *field_node = wanted_type->data.unionation.decl_node->data.container_decl.fields.at(
union_field->enum_field->decl_index);
ErrorMsg *msg = ir_add_error(ira, source_instr,