On Fri, Apr 8, 2011 at 5:45 PM, Jason Merrill wrote: >> +         error ("range-based % expression must have complete >> type"); >> +           error ("range-based % expression has an % member " >> +                  "but not a %"); > > Let's give the type of the range initializer in these error messages. Ok. I've changed the first one to: + error ("range-based % expression of type %qT " + "has incomplete type", TREE_TYPE (range)); Because the type of the expression must have complete type *only* if it is an array. That could be stated in the error, but I don't think it is necessary. >> +static tree >> +cp_parser_range_for_member_function (tree range, tree identifier) >> ... > Instead of handling this difference here, let's teach finish_call_expr to > handle a COMPONENT_REF around a BASELINK. Well, I just did that, but I'm not sure this is totally correct, I've just begun to understand finish_call_expr. It works, if only because I'm the only one using this new code path. Fell free to revise/change/comment about it. Also, I added a few more test cases: one with begin/end as member functions with default arguments and member template functions with default template arguments; other with begin/end member functions as virtual functions. And since we are approaching the acceptability, here it is the changelog: gcc/cp 2011-04-11 Rodrigo Rivas Costa * parser.c (cp_convert_range_for): Split into cp_parser_perform_range_for_lookup. (cp_parser_perform_range_for_lookup): New. (cp_parser_range_for_member_function): New. (cp_parser_for_init_statement): Correct error message. * semantics.c (finish_call_expr): Accept COMPONENT_REF. gcc/testsuite 2011-04-11 Rodrigo Rivas Costa * g++.dg/cpp0x/range-for2.C: Correct for declaration. * g++.dg/cpp0x/range-for3.C: Likewise. * g++.dg/cpp0x/range-for9.C: Correct error message. * g++.dg/cpp0x/range-for11.C: New. * g++.dg/cpp0x/range-for12.C: New. * g++.dg/cpp0x/range-for13.C: New. * g++.dg/cpp0x/range-for14.C: New. * g++.dg/cpp0x/range-for15.C: New. * g++.dg/cpp0x/range-for16.C: New. Best regards. -- Rodrigo