[cfe-commits] r57640 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/property-9.m
Steve Naroff
snaroff at apple.com
Thu Oct 16 07:59:38 PDT 2008
Author: snaroff
Date: Thu Oct 16 09:59:30 2008
New Revision: 57640
URL: http://llvm.org/viewvc/llvm-project?rev=57640&view=rev
Log:
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
Added:
cfe/trunk/test/SemaObjC/property-9.m
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=57640&r1=57639&r2=57640&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Thu Oct 16 09:59:30 2008
@@ -1274,9 +1274,7 @@
// 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;
Added: cfe/trunk/test/SemaObjC/property-9.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-9.m?rev=57640&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/property-9.m (added)
+++ cfe/trunk/test/SemaObjC/property-9.m Thu Oct 16 09:59:30 2008
@@ -0,0 +1,38 @@
+// RUN: clang -fsyntax-only -verify %s
+
+typedef signed char BOOL;
+ at protocol NSObject - (BOOL)isEqual:(id)object; @end
+
+ at interface NSObject <NSObject> {} @end
+
+ at interface _NSServicesInContextMenu : NSObject {
+ id _requestor;
+ NSObject *_appleEventDescriptor;
+}
+
+ at property (retain, nonatomic) id requestor;
+ at property (retain, nonatomic) id appleEventDescriptor;
+
+ at end
+
+ at implementation _NSServicesInContextMenu
+
+ at synthesize requestor = _requestor, appleEventDescriptor = _appleEventDescriptor;
+
+ at end
+
+ at class NSString;
+
+ at protocol MyProtocol
+- (NSString *)stringValue;
+ at end
+
+ at interface MyClass : NSObject {
+ id _myIvar;
+}
+ at property (readwrite, retain) id<MyProtocol> myIvar;
+ at end
+
+ at implementation MyClass
+ at synthesize myIvar = _myIvar;
+ at end
More information about the cfe-commits
mailing list