зеркало из https://github.com/microsoft/clang-1.git
objective-c++ must take into account qualifiers when
considering valid objc pointer converions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98557 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
8efb5812b8
Коммит
ee9ca6966d
|
@ -1135,6 +1135,12 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
|
||||||
// Objective C++: We're able to convert from a pointer to an
|
// Objective C++: We're able to convert from a pointer to an
|
||||||
// interface to a pointer to a different interface.
|
// interface to a pointer to a different interface.
|
||||||
if (Context.canAssignObjCInterfaces(ToObjCPtr, FromObjCPtr)) {
|
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;
|
ConvertedType = ToType;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,3 +24,15 @@ void RandomFunc(CFMDRef theDict, const void *key, const void *value);
|
||||||
RandomFunc((CFMDRef)dict, key, objects[3]);
|
RandomFunc((CFMDRef)dict, key, objects[3]);
|
||||||
}
|
}
|
||||||
@end
|
@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'}}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче