<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69572>69572</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
_Static_assert not accepted in empty switch/case clause
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
joeyye-work
</td>
</tr>
</table>
<pre>
```
#include <assert.h>
int main(int x, char **argv)
{
switch (x) {
case 1:
// x++; // Uncommenting this will pass
_Static_assert(1, "error message");
break;
};
return x;
}
```
compiled with clang -c c.c -std=c11
error: expected expression
_Static_assert(1, "error message");
Impacted version: from llvm-14 to llvm-17
Strange thing is if I put some statements before the _Static_assert it will work.
GCC compiles it fine.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykU01v4zgM_TX0hUhgS_HXwYd8bBY9F3suZJmx1cqSIclN8u8Xctxpp8WchhBsQnyiHp9I4b3qDVED-QHyUyLmMFjXvFq632lzte4taW13b6BI15WeIN0D48pIPXeEwI_Ce3JhOwD_5xFWJuAolAFWRfcG7IhyEA6B7YHthevfgdVrqvLwcHA1f1VBDgisugGr8Uf8w6TwhBnw_RoGdgZ2jpcd4uIH_Nj6z0g7jmSCMj2GQXm8Kq1xEt6vZ1-egwhKvjwqAVZlkTIwRs5ZhyN5L3oCxiJt_gdC0VpH4u0TAeXpB9xRmJ3B269ABD2c30WWdpyUpg6vKgwotTA9biTKrcSNDx3wk8yyB3ShCXyPdJtIBuqi48h7Zc3flPj4Po2TWJK-k1sy8j1enB1R6_dxk-0w2NUtvx57Dk6YnqLipkflUV3wCac5oLcjoQ8iUHwVjy1drItA-kYTVXi8VezE7dfk_x6PuArkI-qiDK2ApGt4V_NaJNRkRV2Wac5YlQyNrIu2q_OiqrOK8uJSMn6hos2KLi0l31GiGpYynqVZnVa7Mq22ZZFnRZrmdZcKXosKdimNQultLHdrXZ8o72dqijovWaJFS9ovo8SYoSsuwShpfkpcs0jUzr2HXaqVD_4zS1BBU_OtdmMDCilpitIrgzRO4b6OB7Dz0v9Si9lTMjvdDCFMPo7D0vS9CsPcbqUdgZ3jPetvMzn7SjIAOy_sPLDzwv7_AAAA__80rzO8">