aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 293066afd5..1710a3b3fd 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -4113,6 +4113,8 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
static LLVMValueRef ir_render_struct_field_ptr(CodeGen *g, IrExecutable *executable,
IrInstructionStructFieldPtr *instruction)
{
+ Error err;
+
if (instruction->base.value.special != ConstValSpecialRuntime)
return nullptr;
@@ -4130,6 +4132,11 @@ static LLVMValueRef ir_render_struct_field_ptr(CodeGen *g, IrExecutable *executa
return struct_ptr;
}
+ ZigType *struct_type = (struct_ptr_type->id == ZigTypeIdPointer) ?
+ struct_ptr_type->data.pointer.child_type : struct_ptr_type;
+ if ((err = type_resolve(g, struct_type, ResolveStatusLLVMFull)))
+ report_errors_and_exit(g);
+
assert(field->gen_index != SIZE_MAX);
return LLVMBuildStructGEP(g->builder, struct_ptr, (unsigned)field->gen_index, "");
}