cv-qualification conversions. More specifically, there's an implicit
cv-qualification conversion (even one that drops qualifiers) when
converting to 'id' or qualified 'id'. Fixes <rdar://problem/
8734046>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121047
91177308-0d34-0410-b5e6-
96231b3b80d8
assert((FromPtr->getTypeClass() == Type::Pointer ||
FromPtr->getTypeClass() == Type::ObjCObjectPointer) &&
"Invalid similarly-qualified pointer type");
+
+ /// \brief Conversions to 'id' subsume cv-qualifier conversions.
+ if (ToType->isObjCIdType() || ToType->isObjCQualifiedIdType())
+ return ToType.getUnqualifiedType();
+
QualType CanonFromPointee
= Context.getCanonicalType(FromPtr->getPointeeType());
QualType CanonToPointee = Context.getCanonicalType(ToPointee);
}
+
+namespace rdar8734046 {
+ void f1(id);
+ void f2(id<P0>);
+ void g(const A *a) {
+ f1(a);
+ f2(a);
+ }
+}