forked from OSchip/llvm-project
Allow conversion of qualified Class type to unqualified
Class type to match gcc's. Fixes radar 7789113. llvm-svn: 99425
This commit is contained in:
parent
583e05d8ce
commit
9b37b1d6bb
|
@ -4594,13 +4594,15 @@ Sema::AssignConvertType
|
||||||
Sema::CheckObjCPointerTypesForAssignment(QualType lhsType, QualType rhsType) {
|
Sema::CheckObjCPointerTypesForAssignment(QualType lhsType, QualType rhsType) {
|
||||||
if (lhsType->isObjCBuiltinType()) {
|
if (lhsType->isObjCBuiltinType()) {
|
||||||
// Class is not compatible with ObjC object pointers.
|
// Class is not compatible with ObjC object pointers.
|
||||||
if (lhsType->isObjCClassType() && !rhsType->isObjCBuiltinType())
|
if (lhsType->isObjCClassType() && !rhsType->isObjCBuiltinType() &&
|
||||||
|
!rhsType->isObjCQualifiedClassType())
|
||||||
return IncompatiblePointer;
|
return IncompatiblePointer;
|
||||||
return Compatible;
|
return Compatible;
|
||||||
}
|
}
|
||||||
if (rhsType->isObjCBuiltinType()) {
|
if (rhsType->isObjCBuiltinType()) {
|
||||||
// Class is not compatible with ObjC object pointers.
|
// Class is not compatible with ObjC object pointers.
|
||||||
if (rhsType->isObjCClassType() && !lhsType->isObjCBuiltinType())
|
if (rhsType->isObjCClassType() && !lhsType->isObjCBuiltinType() &&
|
||||||
|
!lhsType->isObjCQualifiedClassType())
|
||||||
return IncompatiblePointer;
|
return IncompatiblePointer;
|
||||||
return Compatible;
|
return Compatible;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,5 +66,10 @@ int main()
|
||||||
if (obj_C == j) foo() ; // expected-warning {{comparison of distinct pointer types ('Class' and 'int *')}}
|
if (obj_C == j) foo() ; // expected-warning {{comparison of distinct pointer types ('Class' and 'int *')}}
|
||||||
if (j == obj_C) foo() ; // expected-warning {{comparison of distinct pointer types ('int *' and 'Class')}}
|
if (j == obj_C) foo() ; // expected-warning {{comparison of distinct pointer types ('int *' and 'Class')}}
|
||||||
|
|
||||||
|
Class bar1 = Nil;
|
||||||
|
Class <MyProtocol> bar = Nil;
|
||||||
|
bar = bar1;
|
||||||
|
bar1 = bar;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue