<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58632>58632</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Possible bug with labels at the end of compound statements in C
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c,
clang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
OCHyams
</td>
</tr>
</table>
<pre>
With this test case `test.c`:
```
void fun(void) {
label:
}
```
Before [D133887](https://reviews.llvm.org/D133887) we got an error:
```
$ clang label.c -c -std=c17
label.c:3:1: error: expected statement
}
^
1 error generated.
```
With [D133887](https://reviews.llvm.org/D133887) we just get a warning:
```
$ clang label.c -c -std=c17
label.c:3:1: warning: label at end of compound statement is a C2x extension [-Wc2x-extensions]
}
^
1 warning generated.
```
I'm not very familiar with the C standard but it seemed suspicious that this error has become a warning even though `-std=c17` is specified in the example. Is this a bug?
Also see on [compiler explorer](https://godbolt.org/z/oc54T61sz) with clang-15 vs trunk.
cc @cor3ntin and @Izaron from [D133887](https://reviews.llvm.org/D133887).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytk1Fv2yAQxz-N_XKKZePYSR78kCar1qftYdKeMZwdOgwR4CTtp99hZ21UtdOkTjI2GLj7348_rZVPzU8VDhAOykNAH0Bwj5DUeRxkgjpJuU3yfZJvY39-puHJKgndaBK2jt2EbSBZ3c1zmreoXzeu9u9GmN932FlHKau7fVGW6_UqqfYU8xDC0ccQ7J4ehyeFZ59pfRoy63r69Wc15T0j9DYAN4DOWfeR4oQtQWhuepj0ZQIW9Pggk3IvitWNdCq83JbUCmovQQEvRxQBJfjAAw5owtsCqy9zp5g3QY8GHa2V2V8IzO_pHD5J4XGkE-yRUMCZO6NM_79ZvIadNwIPgEaC7UDY4WhHc0MHyFQcduxC5AIar6yJFS5-CnZZvPzysdQPOV4T_hvJh4StBjDkhRO6J-j4oLTiDs6zxxF2UZyR3EloR9IXwCNJJc2jPyqh7EjX4EA1TRdiPsMD99AiVYevWAFPaGiRHftDvC035Oo8lu3JKapTFFmZKTNe-HDUmMGDn4NzUkAc72_1b7W3URHMoCJRpdFF42m6JO49U_RWtlaHqx-eqVlRLX_UhX-eXBFLn056UVRwouRuNL-y26xCQLLMhXWlCaSW-MTxwzN3JKNzdviMLa-ZUmyKuq5Xm3pT1KlsSrkpNzwNKmhsKPwuKqTg8N16r1qNkc4sfvKZh-lQ8GOz-Uh6l45ON28AUZCxzWgHDaLG62dxdPaR7jMNlfcjeupU67pk6aFpc1kjl50QnC1lXedyU_Nq2bKiXRatwHQWFZUnjAlqCdtB7E51lFvCZsjfMs5U-1Q1LGesyFldVPm6rDMhC8F5niPvimK9XBNwHLjSLxBT10wiCYOnSa18eCWccoLUG5zQxfh8JC-65tvu6xMffDrV00zF_AYPrsUh">