<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/152216>152216</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Implement DR277 to reject non-object declarations in for loops pre-C23
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Halalaluyafail3
</td>
</tr>
</table>
<pre>
Clang incorrectly allows the following for loop:
```c
for (enum fred { jim, sheila = 10 } i = jim; i < sheila; i++);
```
This is invalid and is mentioned specifically in [DR277](https://www.open-std.org/jtc1/sc22/wg14/issues/c99/issue0277.html).
Also, I think it is worth specifically mentioning object declarations in structures with no tag here e.g.:
```c
for(struct{int x;}x;0;);
```
GCC accepts this and I think it is fine, since members are objects.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0U91uozwQfZrhZhTkDBDCBRf5Ub6vt6t9AWMGcNfYyDbN5u1Xpqm2lbpiJHsY_5w551iGoEfL3EJ1huqayTVOzrf_S5O-9SEHqU2Rda5_tBcj7YjaKuc9q2geKI1x94BxYhxcmms74uA8GucWKE4gTnAQ76FAnFIJ6Mh2nXHw3CPUZ3zVM9AFw8TaSITiinuBUF9Rb0kqF-ct-Vi05UDnLRoozp_vAXH6OemAKeybNLpHafuUzmyjdpZ7DAsrPWgljXmgtgjV-fqD6hqqK9BxinEJCT3dgG73-z13C9tdiH3u_Ah0e41qD3QLiigtGPcl0E2HsHIAuqmm-UgF1XU-xdkANXkCKU4nE1xq9wXjpO0v1DFBuzsfp6-wnmgTo657ZRWxZ2Wkl-lv6g1D9KuKq-eAdx0ntA6jHHFiz8j5mH8vANDxfSPUZ20j_k781dc0iDT9jtD_LheUSvESk9g6bIx-7WDQljcZtVWMM88d-4DS8xN9yLO-LfqmaGTG7b6uyrIoqDxmU9sprquy7w5NwQdRcTHsWdZ1VTFz3xdDplsSVImjqIiKUhzzuhzqRnSi6kRPXdFAKXiW2uTGvM1JpGyjv91XRPtDZmTHJmwWJ7J8x60KRMnxvk2bdt06BiiF0SGGv8dEHQ23L_NiOOmBm0swOvS8SWKd3f1DnY9nEHDxvLtQka3etF-9Neo4rV2u3Ax0S5c-h93iXTr0s62evby19CcAAP__NPorOA">