From 60331be08da5ef89a416a495c9a7bb9b8b375dea Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Fri, 10 Apr 2009 22:42:54 +0000 Subject: [PATCH] Fix another fallout from defining __weak unconditionally. llvm-svn: 68834 --- clang/lib/Sema/SemaDeclObjC.cpp | 3 ++- clang/test/SemaObjC/no-gc-weak-test.m | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 898ecbb47168..74a031643135 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1840,7 +1840,8 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, return DeclPtrTy(); } if ((Context.isObjCObjectPointerType(property->getType()) || - PropType.isObjCGCStrong()) && IvarType.isObjCGCWeak()) { + PropType.isObjCGCStrong()) && IvarType.isObjCGCWeak() && + getLangOptions().getGCMode() != LangOptions::NonGC) { Diag(PropertyLoc, diag::error_strong_property) << property->getDeclName() << Ivar->getDeclName(); return DeclPtrTy(); diff --git a/clang/test/SemaObjC/no-gc-weak-test.m b/clang/test/SemaObjC/no-gc-weak-test.m index 03a881f589a6..f494929ce02d 100644 --- a/clang/test/SemaObjC/no-gc-weak-test.m +++ b/clang/test/SemaObjC/no-gc-weak-test.m @@ -12,3 +12,17 @@ @end +@interface PVSelectionOverlayView2 +{ + id __weak _selectionRect; +} + +@property(assign) id selectionRect; + +@end + +@implementation PVSelectionOverlayView2 + +@synthesize selectionRect = _selectionRect; +@end +