summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-10-16 14:59:30 +0000
committerSteve Naroff <snaroff@apple.com>2008-10-16 14:59:30 +0000
commit9546eee50ae6aa0cf182ec6ec7fa154e8c23ca9a (patch)
tree2d86280b7cb3231ffad443bb39a5f0d88d3c0df1
parent35945b6af207f5c4e6b901d330bd7c8741da8c91 (diff)
downloadbcm5719-llvm-9546eee50ae6aa0cf182ec6ec7fa154e8c23ca9a.tar.gz
bcm5719-llvm-9546eee50ae6aa0cf182ec6ec7fa154e8c23ca9a.zip
Fix <rdar://problem/6239726> Parser rejects: type of property 'list' does not match type of ivar
and http://llvm.org/bugs/show_bug.cgi?id=2893 llvm-svn: 57640
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp4
-rw-r--r--clang/test/SemaObjC/property-9.m38
2 files changed, 39 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 05c3bc78b31..6375d91448b 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -1274,9 +1274,7 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
// Check that type of property and its ivar are type compatible.
if (PropType != IvarType) {
- // A readonly property is allowed to be a sub-class of the ivar type.
- if (!property->isReadOnly() ||
- CheckAssignmentConstraints(PropType, IvarType) != Compatible) {
+ if (CheckAssignmentConstraints(PropType, IvarType) != Compatible) {
Diag(PropertyLoc, diag::error_property_ivar_type, property->getName(),
Ivar->getName());
return 0;
diff --git a/clang/test/SemaObjC/property-9.m b/clang/test/SemaObjC/property-9.m
new file mode 100644
index 00000000000..b83291aacaa
--- /dev/null
+++ b/clang/test/SemaObjC/property-9.m
@@ -0,0 +1,38 @@
+// RUN: clang -fsyntax-only -verify %s
+
+typedef signed char BOOL;
+@protocol NSObject - (BOOL)isEqual:(id)object; @end
+
+@interface NSObject <NSObject> {} @end
+
+@interface _NSServicesInContextMenu : NSObject {
+ id _requestor;
+ NSObject *_appleEventDescriptor;
+}
+
+@property (retain, nonatomic) id requestor;
+@property (retain, nonatomic) id appleEventDescriptor;
+
+@end
+
+@implementation _NSServicesInContextMenu
+
+@synthesize requestor = _requestor, appleEventDescriptor = _appleEventDescriptor;
+
+@end
+
+@class NSString;
+
+@protocol MyProtocol
+- (NSString *)stringValue;
+@end
+
+@interface MyClass : NSObject {
+ id _myIvar;
+}
+@property (readwrite, retain) id<MyProtocol> myIvar;
+@end
+
+@implementation MyClass
+@synthesize myIvar = _myIvar;
+@end
OpenPOWER on IntegriCloud