aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-03-11 11:09:15 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-03-11 11:09:15 -0400
commit1d5e349a52de9f4d056d50a1e41b89e7b0184a05 (patch)
tree3ba6ab7e80295a12cee83117ba6b772c3829aaee /src
parentbcbb2650c5a7dca900861cc23f60374d29d50ec4 (diff)
downloadzig-1d5e349a52de9f4d056d50a1e41b89e7b0184a05.tar.gz
zig-1d5e349a52de9f4d056d50a1e41b89e7b0184a05.zip
ir: fix handling of OnePossibleValueInvalid
this is the poison value which means a compile error has already been reported
Diffstat (limited to 'src')
-rw-r--r--src/ir.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index e8306913f9..7d5a5305b1 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -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,