aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorVexu <git@vexu.eu>2020-01-15 20:23:49 +0200
committerVexu <git@vexu.eu>2020-01-15 20:24:59 +0200
commit6fd0dddf186f6435f422f2992f44ec9a35e09f20 (patch)
tree4b285418ef2d5f47262247fa21040a7b0fb01c86 /src/codegen.cpp
parent8d9d4a065820bfce0395465834cb9b7e01509a12 (diff)
downloadzig-6fd0dddf186f6435f422f2992f44ec9a35e09f20.tar.gz
zig-6fd0dddf186f6435f422f2992f44ec9a35e09f20.zip
implement non-exhaustive enums
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 9bab5fd878..0dc820be51 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -3356,7 +3356,7 @@ static LLVMValueRef ir_render_int_to_enum(CodeGen *g, IrExecutable *executable,
LLVMValueRef tag_int_value = gen_widen_or_shorten(g, ir_want_runtime_safety(g, &instruction->base),
instruction->target->value->type, tag_int_type, target_val);
- if (ir_want_runtime_safety(g, &instruction->base) && wanted_type->data.enumeration.layout != ContainerLayoutExtern) {
+ if (ir_want_runtime_safety(g, &instruction->base) && !wanted_type->data.enumeration.non_exhaustive) {
LLVMBasicBlockRef bad_value_block = LLVMAppendBasicBlock(g->cur_fn_val, "BadValue");
LLVMBasicBlockRef ok_value_block = LLVMAppendBasicBlock(g->cur_fn_val, "OkValue");
size_t field_count = wanted_type->data.enumeration.src_field_count;