aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-01-09 10:44:57 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-01-09 10:44:57 -0500
commit3b2eeb839bb34903596edeae041b5d9ab189282d (patch)
tree05c4b419771e26ed502e282d2ad4594e52f938cb /src/codegen.cpp
parent027a0c46aef9828ab07d6342030c1ba5b5e4f769 (diff)
parent5864d92b4049e6d60a21a3f22220464808dd0518 (diff)
downloadzig-3b2eeb839bb34903596edeae041b5d9ab189282d.tar.gz
zig-3b2eeb839bb34903596edeae041b5d9ab189282d.zip
Merge remote-tracking branch 'origin/master' into llvm8
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index dd2f2b6565..e180b69215 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -5626,6 +5626,8 @@ static LLVMValueRef gen_const_val_ptr(CodeGen *g, ConstExprValue *const_val, con
}
static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const char *name) {
+ Error err;
+
ZigType *type_entry = const_val->type;
assert(!type_entry->zero_bits);
@@ -5769,6 +5771,12 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
}
ConstExprValue *field_val = &const_val->data.x_struct.fields[i];
assert(field_val->type != nullptr);
+ if ((err = ensure_const_val_repr(nullptr, g, nullptr, field_val,
+ type_struct_field->type_entry)))
+ {
+ zig_unreachable();
+ }
+
LLVMValueRef val = gen_const_val(g, field_val, "");
fields[type_struct_field->gen_index] = val;
make_unnamed_struct = make_unnamed_struct || is_llvm_value_unnamed_type(field_val->type, val);