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:
Fariborz Jahanian 2010-03-24 21:00:27 +00:00
parent 583e05d8ce
commit 9b37b1d6bb
2 changed files with 9 additions and 2 deletions

View File

@ -4594,13 +4594,15 @@ Sema::AssignConvertType
Sema::CheckObjCPointerTypesForAssignment(QualType lhsType, QualType rhsType) {
if (lhsType->isObjCBuiltinType()) {
// Class is not compatible with ObjC object pointers.
if (lhsType->isObjCClassType() && !rhsType->isObjCBuiltinType())
if (lhsType->isObjCClassType() && !rhsType->isObjCBuiltinType() &&
!rhsType->isObjCQualifiedClassType())
return IncompatiblePointer;
return Compatible;
}
if (rhsType->isObjCBuiltinType()) {
// Class is not compatible with ObjC object pointers.
if (rhsType->isObjCClassType() && !lhsType->isObjCBuiltinType())
if (rhsType->isObjCClassType() && !lhsType->isObjCBuiltinType() &&
!lhsType->isObjCQualifiedClassType())
return IncompatiblePointer;
return Compatible;
}

View File

@ -66,5 +66,10 @@ int main()
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')}}
Class bar1 = Nil;
Class <MyProtocol> bar = Nil;
bar = bar1;
bar1 = bar;
return 0;
}