-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerfalse-positiveWarning fires when it should notWarning fires when it should not
Description
Compiling the following code with Clang trunk and -Wswitch-default
option produces "'switch' missing 'default' label" warning, despite the label clearly being there:
template<typename Index>
int f1(Index i)
{
switch (i)
{
case 0: return 0;
case 1: return 1;
default: return 2;
}
}
$ clang++ -fsyntax-only -Wswitch-default test.cpp
test.cpp:4:5: warning: 'switch' missing 'default' label [-Wswitch-default]
4 | switch (i)
| ^
1 warning generated.
$ clang++ --version
clang version 18.0.0git (https://github.com/llvm/llvm-project.git c0d2ea9d4202c7cce4214b3057a709ff2f1128ae)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/aland/llvm-project/build/install//bin
Godbolt: https://godbolt.org/z/c3a695b5n
Related to #73077
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerfalse-positiveWarning fires when it should notWarning fires when it should not