> Well, yes, this is true but there is still the issue that > > void f() { > for(class C{};;) > ; > } > > generates the message > > error: types may not be defined in range-based for loops > > when compiled with -std=c++0x and no patches and that is odd since this > loop isn't range-based. Oh, I see... The problem is that regular C for loops allows defining types in the first statement, whereas range-based for loops do not. That, if I'm reading the draft correctly.
So the problem is that when setting the type_definition_forbidden_message to non-NULL, when it sees the type it calls error() instead of cp_parser_error() so the cp_parser_parse_tentatively has no effect. The easy solution would be to remove the assignment to type_definition_forbidden_message and then check for this case particulary. Or we can change the cp_parser_check_type_definition() function to call cp_parser_error() instead of error(). Or we can just accept the type definition in the range-for and hope that nobody will notice :P Regards. Rodrigo