aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorVexu <git@vexu.eu>2019-12-15 00:05:13 +0200
committerAndrew Kelley <andrew@ziglang.org>2019-12-15 19:28:53 -0500
commit0f38410ea6f60ce9cebf373069d4abfcac0e77e6 (patch)
treea57673939888845bd3eb1553da5d6a23342e0e7f /src/codegen.cpp
parent59de23dfa010c5556f79fbb8b4c637c8d150fd88 (diff)
downloadzig-0f38410ea6f60ce9cebf373069d4abfcac0e77e6.tar.gz
zig-0f38410ea6f60ce9cebf373069d4abfcac0e77e6.zip
improve extern enum
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 45e6f867eb..1b77f0752a 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -3292,7 +3292,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)) {
+ if (ir_want_runtime_safety(g, &instruction->base) && wanted_type->data.enumeration.layout != ContainerLayoutExtern) {
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;