Closed
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