mirror of git://gcc.gnu.org/git/gcc.git
PR c++/86060 - ICE on range for with -std=c++98.
* parser.c (cp_parser_init_statement): Don't clobber *decl after pedwarn. From-SVN: r261239
This commit is contained in:
parent
4dbdb49b1b
commit
b66ec0c032
|
|
@ -1,5 +1,9 @@
|
||||||
2018-06-06 Jason Merrill <jason@redhat.com>
|
2018-06-06 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/86060 - ICE on range for with -std=c++98.
|
||||||
|
* parser.c (cp_parser_init_statement): Don't clobber *decl after
|
||||||
|
pedwarn.
|
||||||
|
|
||||||
PR c++/85710 - ICE with -Wmemset-elt-size.
|
PR c++/85710 - ICE with -Wmemset-elt-size.
|
||||||
* semantics.c (finish_call_expr): Call warn_for_memset here.
|
* semantics.c (finish_call_expr): Call warn_for_memset here.
|
||||||
* parser.c (cp_parser_postfix_expression): Not here.
|
* parser.c (cp_parser_postfix_expression): Not here.
|
||||||
|
|
|
||||||
|
|
@ -12384,12 +12384,9 @@ cp_parser_init_statement (cp_parser *parser, tree *decl)
|
||||||
cp_lexer_consume_token (parser->lexer);
|
cp_lexer_consume_token (parser->lexer);
|
||||||
is_range_for = true;
|
is_range_for = true;
|
||||||
if (cxx_dialect < cxx11)
|
if (cxx_dialect < cxx11)
|
||||||
{
|
pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0,
|
||||||
pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0,
|
"range-based %<for%> loops only available with "
|
||||||
"range-based %<for%> loops only available with "
|
"-std=c++11 or -std=gnu++11");
|
||||||
"-std=c++11 or -std=gnu++11");
|
|
||||||
*decl = error_mark_node;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* The ';' is not consumed yet because we told
|
/* The ';' is not consumed yet because we told
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
// PR c++/86060
|
||||||
|
// { dg-options -Wpedantic }
|
||||||
|
|
||||||
|
template <typename T> void foo(T (&a)[8]) {
|
||||||
|
for (int i : a) // { dg-warning "range-based" "" { target c++98_only } }
|
||||||
|
i;
|
||||||
|
}
|
||||||
|
void fn1() { foo<int>; }
|
||||||
Loading…
Reference in New Issue