<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/143216>143216</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang error report missing location
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jurahul
</td>
</tr>
</table>
<pre>
See https://godbolt.org/z/szcWh6Mqa
For this small program which uses macros,
```
#define ODD_NUMBERS \
1 \
case 3: \
case 5
#define EVEN_NUMBERS \
0: \
case 2: \
case 4
int classify(int x) {
switch (x) {
case 1:
//case 1
case 3:
case 5: return 0;
case 0:
case 2:
case 4: return 1;
default: return 2;
}
}
int classify1(int x) {
switch (x) {
case ODD_NUMBERS: return 0;
case EVEN_NUMBERS: return 1;
default: return 2;
}
}
int main() {
return classify(0) + classify1(1);
}
```
The missing `:` after case 1 in the non-macro version is reported with proper location:
```
<source>:15:9: error: expected ':' after 'case'
15 | case 1
| ^
| :
```
However, the missing `:` for the case in macro is just reported as:
```
error: expected ':' after 'case'
```
with no line information.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVE1zozgQ_TXNRRWX1AJsHziQxNReZrZqZz-OWwIao5RAXkkkM_PrtwQkwUnmEMplW63ux3uvW1Le6_NIVEB2C9l9oqbQW1c8TE71k0lq2_4ovhGxPoSLB1kCVoDV2ba1NWFn3Rmw-glY-Z_NP33-5T8FvAReVtax0GvP_KCMYRdnz04N7KnXTc8mT54NqnHWA94tBZDz9cNLQNlSp0div9_f__v1ry-3pz--MchiKlse8bJslCcmQZbXkWyFfYE6_X36-jEWf1eM7yLpCsdLPQbWmGhb9wPwEJffAY8M9rdzun_SoekZ4OEqPKOIaGBcLS6usSsVWwWyZI7C5MZIcQPDr_LwapVuqsRzVUudmkzYbOHzFuzvo67l-1qd-Ky8Tbd-yX3bhs9R_YDpoPQIeNgSWYs2HeLzNt5e6RKAxwV3BdyOHy__7IkN2ns9nlkMypjAVBfIrZ1kemShJzba8WYeZfZIzms7Mu2Zo4t1gVr2pEMfh_9CjhnbqKDtuLTr7TvlnbeTawjkCWQpYvOP0QRyzrr5z_cLNRETcD-fw_3KB3AfKcXwPNIiY7C_Y5vhik8MPT-QnT6Oy3e0ePmbfaJHcoB3s973rnTzUaflhXpcDnZ04WHy4dUK5T8U_kl9b8jN_o6WmXjC9dhZN8we75K2kO1RHlVChdinR8xEnoqkL1R6PPC27jiirPPDIT_yg8K6a0VW1xmJRBfIMeM5z1GKlIsdKqUaSmWdZxSnE1JOg9JmZ8zjEG_ARHs_USFSiSJPjKrJ-Pk6RWyMGs-AGG9WV8SCm3o6e0i50T74V4igg6FiTl9avhr34vfz9CSTM8Wby1iHfqp3jR0Aq4i4_txcnH2gJgBWM0MPWK0kHwv8PwAA__9Eq7UP">