Issue 152216
Summary Implement DR277 to reject non-object declarations in for loops pre-C23
Labels new issue
Assignees
Reporter Halalaluyafail3
    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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to