<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/75943>75943</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] False-positive with -Wswitch-default and templates
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          al42and
      </td>
    </tr>
</table>

<pre>
    Compiling the following code with Clang trunk and ` -Wswitch-default` option produces "'switch' missing 'default' label" warning, despite the label clearly being there:

```cpp
template<typename Index>
int f1(Index i)
{
 switch (i)
    {
        case 0: return 0;
        case 1: return 1;
        default: return 2;
    }
}
```

```console
$ 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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVF2vozYQ_TXOy4jIjCGEBx7yUap9rSr1sTL2hLjr2Aibm6S_vjIkm917b6tuFCUwc8acOWcYGYLpHVHDyj0rjys5xbMfG2kLlE6vOq_vzcFfBmON6yGeCU7eWn9Nd8prgquJZzhYmbLj5L6CdBrYhkP2R7iaqM6ZppOcbEwxP0TjHQyj15OiAAyRYbXgGFZwMSGkkxlWzyqswMqOLEOEqxydcT3DA2gKg4k0M5rzoCzJ0d6howfTkZjYMX5k_Pm74ctXDcMSiXQZrIzExCHeB3LyQvDFabox8cuCMC7CKWe4ncNgGNaPw6r9cgELfWC4fWUBAF6Ix0fJQMCZ2MFIcRpduv4Mkn8HyT9AnsK8MPgDhlXHJ8Pju74_F8O74C09oliASmYy3DPcQ3YKdxflLfPO3j9YCpFCXKthgKecyy0Tu4KJXZk4Pj0TO_i_VgMr9x-mpzy-WiyAVYdZjH_THr4hWPlwMn9SgZ4cjTKSXv8gyPvWszcag_FuSc8peIQg3675mvcmpkefYxxCmjVsGba9ieepWyt_Ydha-_b8y4bR_0UqrlOV4hpJ1rpAjqpSigrMi07wspIVr08nPOU5biV9a-p3OfY0m37bbv7cFNnkvjp_dZk1brplvZseuPNIUsPFa7IJPfhgbkvqiwtRWkv6aMbFjvbsL8SwlVY6_Y4mw7abjE1hsxQu7XXG_cdU_ep155fhfKfKklj7sWfY_s2wVUJu6rIr3ff1v1F6HTVEDwxFJXhVrXQjdC1quaImr7jgnBe8Xp0bKTpel7jptlulUIhTUWwrrrmgstxqylemQY4ix7zOy4Lzep3n1UaWosSiytWJ16zgdJHGrlPjidrKhDBRU5V1IVbzLIZ5MSI-JgPTjhybWahu6gMruDUhhtcJ0UQ7b9OlojxCK22gLBkRzdtjYX54k9LWfG6jsJpG2_zcVCWbEvfAsJ3p_xMAAP__3Be-ww">