On Mon, 2010-09-20 at 10:39 +0200, Rodrigo Rivas wrote: > > This is quite unreadable and not very informative. > Totally agree. > > > Here there are two problems... > > snipped > > I think that you are taking the wrong approach: you call > "cp_parser_range_for" with C++98 and then if such a loop is parsed > (the ':') you issue an error. > Maybe you should try to add the check to the "cp_parser_c_for" function. > Note that a range-based for always have a declaration in the first > sub-statement, so next the "cp_parser_c_for" will expect a ';' or a > initialization ('(', '=' or '{', IIRC). > If instead of that, a ':' is found there is your chance to diagnose!
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. /MF