Version out inexpressible assert using getPointerElementType() (#4106)

This commit is contained in:
Nicholas Wilson 2022-09-05 11:54:48 +08:00 committed by GitHub
parent 03e35c5ce5
commit 8781a8f1ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1950,6 +1950,7 @@ DValue *makeVarDValue(Type *type, VarDeclaration *vd, llvm::Value *storage) {
expectedType = expectedType->getPointerTo();
if (val->getType() != expectedType) {
#if LDC_LLVM_VER < 1500
// The type of globals is determined by their initializer, and the front-end
// may inject implicit casts for class references and static arrays.
assert(vd->isDataseg() || (vd->storage_class & STCextern) ||
@ -1962,6 +1963,7 @@ DValue *makeVarDValue(Type *type, VarDeclaration *vd, llvm::Value *storage) {
// work as well.
assert(getTypeStoreSize(DtoType(type)) <= getTypeStoreSize(pointeeType) &&
"LValue type mismatch, encountered type too small.");
#endif
val = DtoBitCast(val, expectedType);
}