The following has worked correctly before, but doesn't work anymore with GCC's range-based for-loop support enabled void f() { for(struct { } f;;) ; } error: types may not be defined in range-based for loops Structs in the initial part of the for loop can be useful and they are broken by that diagnostic.
Works for me with revision 168409.
Fixed by the patch from Rodrigo I just checked in.