diff options
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 3 | ||||
-rw-r--r-- | test/SemaObjC/no-gc-weak-test.m | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 17de0a5067..e1583d75b4 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1825,7 +1825,8 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, return DeclPtrTy(); } // __weak is explicit. So it works on Canonical type. - if (PropType.isObjCGCWeak() && !IvarType.isObjCGCWeak()) { + if (PropType.isObjCGCWeak() && !IvarType.isObjCGCWeak() && + getLangOptions().getGCMode() != LangOptions::NonGC) { Diag(PropertyLoc, diag::error_weak_property) << property->getDeclName() << Ivar->getDeclName(); return DeclPtrTy(); diff --git a/test/SemaObjC/no-gc-weak-test.m b/test/SemaObjC/no-gc-weak-test.m new file mode 100644 index 0000000000..e762c05815 --- /dev/null +++ b/test/SemaObjC/no-gc-weak-test.m @@ -0,0 +1,14 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +@interface Subtask +{ + id _delegate; +} +@property(nonatomic,readwrite,assign) id __weak delegate; +@end + +@implementation Subtask +@synthesize delegate = _delegate; +@end + + |