PR4281: Fix bogus CodeGen assertion. The issue is that
getUnqualifiedType() doesn't strip off all qualifiers for non-canonical
types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72552 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index af1bbfd..d90f701 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -178,9 +178,8 @@
}
void AggExprEmitter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
- assert(CGF.getContext().typesAreCompatible(
- E->getSubExpr()->getType().getUnqualifiedType(),
- E->getType().getUnqualifiedType()) &&
+ assert(CGF.getContext().hasSameUnqualifiedType(E->getSubExpr()->getType(),
+ E->getType()) &&
"Implicit cast types must be compatible");
Visit(E->getSubExpr());
}
@@ -226,9 +225,8 @@
void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) {
// For an assignment to work, the value on the right has
// to be compatible with the value on the left.
- assert(CGF.getContext().typesAreCompatible(
- E->getLHS()->getType().getUnqualifiedType(),
- E->getRHS()->getType().getUnqualifiedType())
+ assert(CGF.getContext().hasSameUnqualifiedType(E->getLHS()->getType(),
+ E->getRHS()->getType())
&& "Invalid assignment");
LValue LHS = CGF.EmitLValue(E->getLHS());
@@ -378,8 +376,7 @@
if (E->getNumInits() > 0) {
QualType T1 = E->getType();
QualType T2 = E->getInit(0)->getType();
- if (CGF.getContext().getCanonicalType(T1).getUnqualifiedType() ==
- CGF.getContext().getCanonicalType(T2).getUnqualifiedType()) {
+ if (CGF.getContext().hasSameUnqualifiedType(T1, T2)) {
EmitAggLoadOfLValue(E->getInit(0));
return;
}