[Bug c++/46791] New: GCC fails on "for(struct { } f;;) ;", incorrectly treating it as a range-based for loop
schaub-johannes at web dot de
gcc-bugzilla@gcc.gnu.org
Fri Dec 3 20:02:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46791
Summary: GCC fails on "for(struct { } f;;) ;", incorrectly
treating it as a range-based for loop
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: schaub-johannes@web.de
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.
More information about the Gcc-bugs
mailing list