Skip to content

Commit

Permalink
[Clang][Wswitch-default] Warning for enum even completely covered the…
Browse files Browse the repository at this point in the history
… cases (#75900)

 Adding a test case that this warns even for completely covered switches.
  • Loading branch information
hstk30-hw committed Dec 20, 2023
1 parent 10056c8 commit e5eef6e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions clang/test/Sema/switch-default.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ int f2(int a) {
}
return a;
}

// Warn even completely covered Enum cases(GCC compatibility).
enum E { A, B };
enum E check_enum(enum E e) {
switch (e) { // expected-warning {{'switch' missing 'default' label}}
case A: break;
case B: break;
}
return e;
}

0 comments on commit e5eef6e

Please sign in to comment.