diff options
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 2 | ||||
-rw-r--r-- | test/SemaObjC/property-weak.m | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 96812018a1..174bfc6264 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -761,6 +761,8 @@ static void HandleWeakImportAttr(Decl *D, const AttributeList &Attr, Sema &S) { isDef = (!VD->hasExternalStorage() || VD->getInit()); } else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { isDef = FD->getBody(); + } else if (isa<ObjCPropertyDecl>(D)) { + // We ignore weak import on properties } else { S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << "weak_import" << 2 /*variable and function*/; diff --git a/test/SemaObjC/property-weak.m b/test/SemaObjC/property-weak.m new file mode 100644 index 0000000000..2e5edbd5c5 --- /dev/null +++ b/test/SemaObjC/property-weak.m @@ -0,0 +1,5 @@ +// RUN: clang -triple i386-apple-darwin9 -fsyntax-only -verify %s + +@interface foo +@property(nonatomic) int foo __attribute__((weak_import)); +@end |