InternPool: fix element pointer type computations

This commit is contained in:
Jacob Young
2023-05-31 23:46:39 -04:00
committed by Andrew Kelley
parent 08ae212772
commit 828756ceeb
3 changed files with 13 additions and 9 deletions

View File

@@ -3915,7 +3915,8 @@ pub const DeclGen = struct {
const indices: [1]*llvm.Value = .{
llvm_usize.constInt(elem_ptr.index, .False),
};
const elem_llvm_ty = try dg.lowerType(ptr.ty.toType().elemType2(mod));
const elem_ty = mod.intern_pool.typeOf(elem_ptr.base).toType().elemType2(mod);
const elem_llvm_ty = try dg.lowerType(elem_ty);
return elem_llvm_ty.constInBoundsGEP(parent_llvm_ptr, &indices, indices.len);
},
.field => |field_ptr| {