More type checking for properties, accessors and
use of dot-syntax expression. This is to match gcc's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71243 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index e35b7a9..34afded 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1315,11 +1315,17 @@
if (GetterMethod &&
GetterMethod->getResultType() != property->getType()) {
- Diag(property->getLocation(),
- diag::err_accessor_property_type_mismatch)
- << property->getDeclName()
- << GetterMethod->getSelector();
- Diag(GetterMethod->getLocation(), diag::note_declared_at);
+ AssignConvertType result = Incompatible;
+ if (Context.isObjCObjectPointerType(property->getType()))
+ result = CheckAssignmentConstraints(property->getType(),
+ GetterMethod->getResultType());
+ if (result != Compatible) {
+ Diag(property->getLocation(),
+ diag::warn_accessor_property_type_mismatch)
+ << property->getDeclName()
+ << GetterMethod->getSelector();
+ Diag(GetterMethod->getLocation(), diag::note_declared_at);
+ }
}
if (SetterMethod) {
@@ -1329,7 +1335,7 @@
if (SetterMethod->param_size() != 1 ||
((*SetterMethod->param_begin())->getType() != property->getType())) {
Diag(property->getLocation(),
- diag::err_accessor_property_type_mismatch)
+ diag::warn_accessor_property_type_mismatch)
<< property->getDeclName()
<< SetterMethod->getSelector();
Diag(SetterMethod->getLocation(), diag::note_declared_at);