diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 564c4e56e000b..1a89e689fe941 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -369,7 +369,8 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef Locs, DiagnoseAvailabilityOfDecl(D, Locs, UnknownObjCClass, ObjCPropertyAccess, AvoidPartialAvailabilityChecks, ClassReceiver); - DiagnoseFeatureAvailabilityOfDecl(D, Locs); + if (!AvoidPartialAvailabilityChecks) + DiagnoseFeatureAvailabilityOfDecl(D, Locs); DiagnoseUnusedOfDecl(*this, D, Loc); diff --git a/clang/test/SemaObjC/feature-availability.m b/clang/test/SemaObjC/feature-availability.m index 586b60b24fb65..99fc708bc022e 100644 --- a/clang/test/SemaObjC/feature-availability.m +++ b/clang/test/SemaObjC/feature-availability.m @@ -147,7 +147,7 @@ @interface Base3 @end __attribute__((availability(domain:feature1, AVAIL))) -@interface Base4 // expected-error {{use of 'P1' requires feature 'feature1' to be unavailable}} +@interface Base4 @end __attribute__((availability(domain:feature1, AVAIL))) @@ -166,8 +166,10 @@ @interface Base5(Cat3) @end __attribute__((availability(domain:feature1, UNAVAIL))) -@interface Base5(Cat4) // expected-error {{use of 'P2' requires feature 'feature1' to be available}} +@interface Base5(Cat4) @end -@interface Base6 // expected-error {{use of 'P1' requires feature 'feature1' to be unavailable}} expected-error {{use of 'P2' requires feature 'feature1' to be available}} +@interface Base6 @end + +void foo(id); // expected-error {{use of 'P1' requires feature 'feature1' to be unavailable}}