diff options
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 3 | ||||
-rw-r--r-- | test/SemaObjC/writable-property-in-superclass.m | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 299f101bdb..80d46bcabb 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -835,6 +835,9 @@ bool Sema::isPropertyReadonly(ObjCPropertyDecl *PDecl, ObjCImplementations[IDecl->getIdentifier()]) if (ImpDecl->getInstanceMethod(PDecl->getSetterName())) return false; + // If all fails, look at the super class. + if (ObjCInterfaceDecl *SIDecl = IDecl->getSuperClass()) + return isPropertyReadonly(PDecl, SIDecl); return true; } diff --git a/test/SemaObjC/writable-property-in-superclass.m b/test/SemaObjC/writable-property-in-superclass.m new file mode 100644 index 0000000000..182b1c47bb --- /dev/null +++ b/test/SemaObjC/writable-property-in-superclass.m @@ -0,0 +1,17 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +@interface MessageStore +@property (assign, readonly) int P; +@end + +@interface MessageStore (CAT) +@property (assign) int P; +@end + +@interface NeXTMbox : MessageStore +@end + +@implementation NeXTMbox +- (void) Meth { self.P = 1; } +@end + |