llvm: avoid creating an invalid llvm type

Fixes the following assertion:

```
zig: llvm/lib/IR/Type.cpp:729: static llvm::PointerType* llvm::PointerType::get(llvm::Type*, unsigned int): Assertion `isValidElementType(EltTy) && "Invalid type for pointer element!"' failed.
```
This commit is contained in:
Jacob Young 2022-12-18 21:53:49 -05:00
parent e96f65db77
commit 18f05664dc

View File

@ -4125,7 +4125,7 @@ pub const DeclGen = struct {
else => unreachable,
};
if (bitcast_needed) {
return llvm_ptr.constBitCast((try dg.lowerType(ptr_child_ty)).pointerType(0));
return llvm_ptr.constBitCast((try dg.lowerPtrElemTy(ptr_child_ty)).pointerType(0));
} else {
return llvm_ptr;
}