diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-19 18:06:10 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-19 18:06:10 +0000 |
commit | d4c60909ae7ad1ab603feedf04d457d72e85fbc4 (patch) | |
tree | c956c9eb71af6f7d411d749cef071683968e40a5 /lib | |
parent | b9e1b75772db2c7db566c6034ba90a07f22e35eb (diff) |
Diagnose conversion of 'Class' to/from objective-c
object pointer types.
Fixes radar 7634850.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 6bf8ab90de..28f921daca 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -4592,8 +4592,18 @@ Sema::CheckBlockPointerTypesForAssignment(QualType lhsType, /// for assignment compatibility. Sema::AssignConvertType Sema::CheckObjCPointerTypesForAssignment(QualType lhsType, QualType rhsType) { - if (lhsType->isObjCBuiltinType() || rhsType->isObjCBuiltinType()) + if (lhsType->isObjCBuiltinType()) { + // Class is not compatible with ObjC object pointers. + if (lhsType->isObjCClassType() && !rhsType->isObjCBuiltinType()) + return IncompatiblePointer; return Compatible; + } + if (rhsType->isObjCBuiltinType()) { + // Class is not compatible with ObjC object pointers. + if (rhsType->isObjCClassType() && !lhsType->isObjCBuiltinType()) + return IncompatiblePointer; + return Compatible; + } QualType lhptee = lhsType->getAs<ObjCObjectPointerType>()->getPointeeType(); QualType rhptee = |