zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 105a09e1d654c76addc26fd5616c06fcbd8b6a12 (tree)
parent 234030c37a97d3da7bc6325e4dfb32fe37e9b039
Author: Andrew Kelley <superjoe30@gmail.com>
Date:   Tue, 15 Aug 2017 06:51:33 -0400

fix invalid llvm IR for const enum

closes #394

Diffstat:
Msrc/codegen.cpp | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/codegen.cpp b/src/codegen.cpp @@ -725,8 +725,8 @@ static LLVMValueRef get_panic_msg_ptr_val(CodeGen *g, PanicMsgId msg_id) { ConstExprValue *array_val = create_const_str_lit(g, buf_msg); init_const_slice(g, val, array_val, 0, buf_len(buf_msg), true); - render_const_val_global(g, val, ""); render_const_val(g, val); + render_const_val_global(g, val, ""); assert(val->global_refs->llvm_global); return val->global_refs->llvm_global; @@ -3635,7 +3635,8 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val) { fields[type_struct_field->gen_index] = gen_const_val(g, &const_val->data.x_struct.fields[i]); } } - return LLVMConstNamedStruct(type_entry->type_ref, fields, type_entry->data.structure.gen_field_count); + return LLVMConstStruct(fields, type_entry->data.structure.gen_field_count, + type_entry->data.structure.layout == ContainerLayoutPacked); } case TypeTableEntryIdUnion: {