considering valid objc pointer converions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98557
91177308-0d34-0410-b5e6-
96231b3b80d8
// Objective C++: We're able to convert from a pointer to an
// interface to a pointer to a different interface.
if (Context.canAssignObjCInterfaces(ToObjCPtr, FromObjCPtr)) {
+ const ObjCInterfaceType* LHS = ToObjCPtr->getInterfaceType();
+ const ObjCInterfaceType* RHS = FromObjCPtr->getInterfaceType();
+ if (getLangOptions().CPlusPlus && LHS && RHS &&
+ !ToObjCPtr->getPointeeType().isAtLeastAsQualifiedAs(
+ FromObjCPtr->getPointeeType()))
+ return false;
ConvertedType = ToType;
return true;
}
RandomFunc((CFMDRef)dict, key, objects[3]);
}
@end
+
+@interface I
+- (void) Meth : (I*) Arg;
+@end
+
+void Func (I* arg); // expected-note {{candidate function not viable: no known conversion from 'I const *' to 'I *' for 1st argument}}
+
+void foo(const I *p, I* sel) {
+ [sel Meth : p]; // expected-error {{incompatible type sending 'I const *', expected 'I *'}}
+ Func(p); // expected-error {{no matching function for call to 'Func'}}
+}
+