This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++0x patch] implement range-based for loops


Thank you for your comments. They've been most helpful.
Creating a new TREE type is 'major words' but I think I've done it right.
The attached patch now fully (hopefully) supports templates.

I've added several testcases for the template cases and the error messages,
but I don't know if they are too many or too few...

Comments welcome.

--
Rodrigo

Changelog
--
gcc/cp

2010-08-27  Rodrigo Rivas <rodrigorivascosta@gmail.com>

	Implement range-based for-statements.
	* cp-tree.def (RANGE_FOR_STMT): New.
	* cp-tree.h (RANGE_FOR_DECL, RANGE_FOR_EXPR, RANGE_FOR_BODY): New.
	* cp-tree.h (cp_convert_range_for): Declare.
	* pt.c (tsubst_expr): Add RANGE_FOR_STMT.
	(tsubst_copy_and_build): perform_koenig_lookup takes extra argument.
	* semantics.c (begin_range_for_stmt): New.
	(finish_range_for_decl): New.
	(finish_range_for_stmt): New.
	(perform_koenig_lookup): Add extra argument include_std.
	* parser.c (cp_parser_range_for): New.
	(cp_convert_range_for): New.
	(cp_parser_iteration_statement): Add range-for support.
	(cp_parser_condition): Adjust comment.
	(cp_parser_postfix_expression): perform_koenig_lookup takes extra
	argument.
	* dump.c (cp_dump_tree): Add RANGE_FOR_STMT.
	* cxx-pretty-print.c (): Likewise.
	* lex.c (cxx_init): Likewise.
	* name-lookup.c (lookup_function_nonclass): Add extra argument
	include_std.
	(lookup_arg_dependent): Likewise.
	* name-lookup.h (): Likewise.

gcc/testsuite/

2010-08-27  Rodrigo Rivas <rodrigorivascosta@gmail.com>

	* g++.dg/cpp0x/range-for1.C: New.
	* g++.dg/cpp0x/range-for2.C: New.
	* g++.dg/cpp0x/range-for3.C: New.
	* g++.dg/cpp0x/range-for4.C: New.
	* g++.dg/cpp0x/range-for5.C: New.

Attachment: for.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]