Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/lib/Sema/SemaExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
DiagnoseAvailabilityOfDecl(D, Locs, UnknownObjCClass, ObjCPropertyAccess,
AvoidPartialAvailabilityChecks, ClassReceiver);

DiagnoseFeatureAvailabilityOfDecl(D, Locs);
if (!AvoidPartialAvailabilityChecks)
DiagnoseFeatureAvailabilityOfDecl(D, Locs);

DiagnoseUnusedOfDecl(*this, D, Loc);

Expand Down
8 changes: 5 additions & 3 deletions clang/test/SemaObjC/feature-availability.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ @interface Base3 <P1>
@end

__attribute__((availability(domain:feature1, AVAIL)))
@interface Base4 <P1> // expected-error {{use of 'P1' requires feature 'feature1' to be unavailable}}
@interface Base4 <P1>
@end

__attribute__((availability(domain:feature1, AVAIL)))
Expand All @@ -166,8 +166,10 @@ @interface Base5(Cat3) <P2>
@end

__attribute__((availability(domain:feature1, UNAVAIL)))
@interface Base5(Cat4) <P2> // expected-error {{use of 'P2' requires feature 'feature1' to be available}}
@interface Base5(Cat4) <P2>
@end

@interface Base6 <P1, P2> // expected-error {{use of 'P1' requires feature 'feature1' to be unavailable}} expected-error {{use of 'P2' requires feature 'feature1' to be available}}
@interface Base6 <P1, P2>
@end

void foo(id<P1>); // expected-error {{use of 'P1' requires feature 'feature1' to be unavailable}}