diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 3878341ca7..da0fa3e12a 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1493,9 +1493,11 @@ static void mergeDeclAttributes(Decl *newDecl, const Decl *oldDecl, for (specific_attr_iterator i = oldDecl->specific_attr_begin(), e = oldDecl->specific_attr_end(); i != e; ++i) { - // Ignore deprecated and unavailable attributes if requested. + // Ignore deprecated/unavailable/availability attributes if requested. if (!mergeDeprecation && - (isa(*i) || isa(*i))) + (isa(*i) || + isa(*i) || + isa(*i))) continue; if (!DeclHasAttr(newDecl, *i)) { diff --git a/test/SemaObjC/attr-availability.m b/test/SemaObjC/attr-availability.m new file mode 100644 index 0000000000..8511d131e1 --- /dev/null +++ b/test/SemaObjC/attr-availability.m @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +@interface A +- (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); +@end + +@interface B : A +- (void)method; +@end + +void f(A *a, B *b) { + [a method]; // expected-warning{{'method' is deprecated: first deprecated in Mac OS X 10.2}} + [b method]; +}