> 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! Regards. Rodrigo