Fix for PR4108: be a bit looser with the casts that we accept in
constant initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70483 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index d7c6457..e618dab 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -59,8 +59,9 @@
return EmitUnion(CGM.EmitConstantExpr(SubExpr, SubExpr->getType(), CGF),
Ty);
}
- if (CGM.getContext().getCanonicalType(E->getSubExpr()->getType()) ==
- CGM.getContext().getCanonicalType(E->getType())) {
+ // Explicit and implicit no-op casts
+ QualType Ty = E->getType(), SubTy = E->getSubExpr()->getType();
+ if (CGM.getContext().hasSameUnqualifiedType(Ty, SubTy)) {
return Visit(E->getSubExpr());
}
return 0;