| Issue |
165623
|
| Summary |
bugprone-switch-missing-default-case false positives
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
nick-potenski
|
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:
```c++
int foo(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.
```
[Compiler explorer link](https://godbolt.org/z/xvb5nY4sY).
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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs