Commit 7fb3df5e by Jason Merrill Committed by Jason Merrill

parser.c (cp_parser_for_init_statement): Change range-for error to pedwarn.

	* parser.c (cp_parser_for_init_statement): Change range-for error
	to pedwarn.

From-SVN: r212044
parent daa04b0a
2014-06-26 Jason Merrill <jason@redhat.com>
* parser.c (cp_parser_for_init_statement): Change range-for error
to pedwarn.
N3994 Ranged-based for-loops: The Next Generation
* parser.c (cp_lexer_nth_token_is): New.
(cp_parser_for_init_statement): Allow "for (id : init)".
......
......@@ -10647,9 +10647,9 @@ cp_parser_for_init_statement (cp_parser* parser, tree *decl)
is_range_for = true;
if (cxx_dialect < cxx11)
{
error_at (cp_lexer_peek_token (parser->lexer)->location,
"range-based %<for%> loops are not allowed "
"in C++98 mode");
pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0,
"range-based %<for%> loops only available with "
"-std=c++11 or -std=gnu++11");
*decl = error_mark_node;
}
}
......
// Test for range-based for loop error in C++98 mode
// { dg-do compile }
// { dg-options "-std=c++98" }
// { dg-do compile { target { ! c++11 } } }
void test()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment