diff options
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 4 | ||||
-rw-r--r-- | test/SemaObjC/arc-property-lifetime.m | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 3770b3c373..9004508a47 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -3334,8 +3334,8 @@ static void handleObjCReturnsInnerPointerAttr(Sema &S, Decl *D, ObjCMethodDecl *method = dyn_cast<ObjCMethodDecl>(D); - if (!isa<ObjCMethodDecl>(method)) { - S.Diag(method->getLocStart(), diag::err_attribute_wrong_decl_type) + if (!method || !isa<ObjCMethodDecl>(method)) { + S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) << SourceRange(loc, loc) << attr.getName() << ExpectedMethod; return; } diff --git a/test/SemaObjC/arc-property-lifetime.m b/test/SemaObjC/arc-property-lifetime.m index fad37ccbf4..bd393e0bf5 100644 --- a/test/SemaObjC/arc-property-lifetime.m +++ b/test/SemaObjC/arc-property-lifetime.m @@ -168,3 +168,8 @@ void foo(Baz *f) { f.realy_strong_attr_prop = [[Baz alloc] init]; f.implicit = [[Baz alloc] init]; } + +// rdar://11253688 +@interface Boom +@property (readonly) const void * innerPointer __attribute__((objc_returns_inner_pointer)); // expected-error {{'objc_returns_inner_pointer' attribute only applies to methods}} +@end |