<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61853>61853</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] -Wunreachable-code for trivial variables in switch
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tiagomacarios
</td>
</tr>
</table>
<pre>
Given the following code:
https://godbolt.org/z/PYrzorK5z
```
void bar(int*);
void foo(int i) {
switch (i) {
int temp; // warning: code will never be executed [-Wunreachable-code]
default:
bar(&temp);
}
}
```
clang correctly emits -Wunreachable-code, but I wonder if we could ignore this specific case - declarations of variables with trivial constructors.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsUsGOmzAQ_ZrhMkpEbCBw4JA0oqp66a3q0ZgBpnLsyDahu19fQehm266FAGvezLz39FQIPFiiGvIz5JdETXF0vo6sBndVWnl2IWld91J_5jtZjCNh74xxM9sBtesI5AnSC6SnMcZbWG6iAdEMrmudiXvnBxDNK4jm2w__6vzX_PUBhyLdnvV6d9xhqzyIkm0EcQJRgTxv2Cekd-4BQQZRIRw3CCJimDnqEZf6f7XlLF2RrjeQZ3ywxFl5y3YAeVrF4MzGoKU7eWwJ6RfpKVKHkJ933yfrSelRtYZ2q_L8ss3vqFeTiW9W4Lvz0ASiWDe_E7UU4biNeP78bcvjrY1a3faedDQvSFeOAT9gJD5hO0X8grOzHXnkHmdC7SbTIQ_WecI4csBwI809a9QqEO6wI22UV5GdDeh6vCvPy9SAM8cRo-c7K4Pa2RD9pKPzYZ90tewqWamE6kNRpoeqOmQyGes-L_s8y0VZqFJSqotW9zKjSmZZJVutE65FKmQqZXo45scs21fH7niQVKq2KLTINGQpXRWbvTH36xKhhEOYqC4OZS4To1oy4U9ifb2Adu00BMhSwyGGZ1vkaNZsrw5CfvnANOydf1P4FM52y1MyeVP_E26O49TutbuCaJZl22d38-4n6QiiWQkHEM3K-XcAAAD__8zWDTg">