-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
Description
The bugprone-switch-missing-default-case checker can present false positive findings when a switch's case statement is logically complete even though the switch does not use an enum value.
For example:
int foo(unsigned int in) {
switch (in % 4) {
case 0:
case 1:
case 2:
case 3:
return 1;
}
return 0;
}yields
warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
3 | switch (in % 4) {
| ^
1 warning generated.
FWIW, I understand that the checker's documentation specifically states that it is only looking for the intersection of non-enum switches and missing default cases, so I can understand why my report may be out of scope. It won't hurt my feelings if you want to reject this or file it as an improvement rather than a bug.