File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,11 @@ class DiagnoseUnguardedFeatureAvailability
67
67
68
68
bool TraverseIfStmt (IfStmt *If);
69
69
70
+ // Ignore unguarded uses of enumerators inside case label expressions.
71
+ bool TraverseCaseStmt (CaseStmt *Case) {
72
+ return TraverseStmt (Case->getSubStmt ());
73
+ }
74
+
70
75
bool VisitDeclRefExpr (DeclRefExpr *DRE) {
71
76
diagnoseDeclFeatureAvailability (DRE->getDecl (), DRE->getBeginLoc ());
72
77
return true ;
Original file line number Diff line number Diff line change @@ -235,6 +235,17 @@ void test7(void) {
235
235
enum E e ;
236
236
e = EA ;
237
237
e = EB ; // expected-error {{cannot use 'EB' because feature 'feature2' is unavailable in this context}}
238
+
239
+ switch (e ) {
240
+ case EA : {
241
+ if (__builtin_available (domain :feature2 ))
242
+ e = EB ;
243
+ break ;
244
+ }
245
+ case EB : // no diagnostic
246
+ e = EB ; // expected-error {{cannot use 'EB' because feature 'feature2' is unavailable in this context}}
247
+ break ;
248
+ }
238
249
}
239
250
240
251
if (__builtin_available (domain :feature2 )) {
You can’t perform that action at this time.
0 commit comments