diff options
-rw-r--r-- | lib/ARCMigrate/ARCMT.cpp | 2 | ||||
-rw-r--r-- | test/ARCMT/checking.m | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp index 13bb33d2b8..7f3479604e 100644 --- a/lib/ARCMigrate/ARCMT.cpp +++ b/lib/ARCMigrate/ARCMT.cpp @@ -187,6 +187,8 @@ CompilerInvocation *createInvocationForMigration(CompilerInvocation &origCI) { CInvok->getPreprocessorOpts().addMacroDef(define); CInvok->getLangOpts().ObjCAutoRefCount = true; CInvok->getDiagnosticOpts().ErrorLimit = 0; + CInvok->getDiagnosticOpts().Warnings.push_back( + "error=arc-unsafe-retained-assign"); CInvok->getLangOpts().ObjCNoAutoRefCountRuntime = !HasARCRuntime(origCI); return CInvok.take(); diff --git a/test/ARCMT/checking.m b/test/ARCMT/checking.m index 62387fa23b..8ee7e80bed 100644 --- a/test/ARCMT/checking.m +++ b/test/ARCMT/checking.m @@ -253,3 +253,15 @@ void rdar9491791(int p) { void rdar9504750(id p) { RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}} } + +// rdar://8939557 +@interface TestReadonlyProperty : NSObject +@property(assign,readonly) NSObject *value; +@end + +@implementation TestReadonlyProperty +@synthesize value; +- (void)viewDidLoad { + value = [NSObject new]; // expected-error {{assigning retained object}} +} +@end |