re PR c++/60393 ([c++1y] ICE with with invalid functions with auto parameters)

Fix PR c++/60393

	PR c++/60393
	* parser.c (cp_parser_parameter_declaration_clause): Move generic
	function template unwinding on error into a more general location, ...
	(cp_parser_skip_to_end_of_statement): ... here.

	PR c++/60393
	* g++.dg/cpp1y/pr60393.C: New testcase.

From-SVN: r208426
This commit is contained in:
Adam Butcher 2014-03-08 09:33:03 +00:00 committed by Adam Butcher
parent bd65fc8782
commit 14e6270252
4 changed files with 26 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2014-03-08 Adam Butcher <adam@jessamine.co.uk>
PR c++/60393
* parser.c (cp_parser_parameter_declaration_clause): Move generic
function template unwinding on error into a more general location, ...
(cp_parser_skip_to_end_of_statement): ... here.
2014-03-07 Jason Merrill <jason@redhat.com>
* Make-lang.in (check_g++_parallelize): Split dg.exp.

View File

@ -3136,6 +3136,10 @@ cp_parser_skip_to_end_of_statement (cp_parser* parser)
{
unsigned nesting_depth = 0;
/* Unwind generic function template scope if necessary. */
if (parser->fully_implicit_function_template_p)
finish_fully_implicit_template (parser, /*member_decl_opt=*/0);
while (true)
{
cp_token *token = cp_lexer_peek_token (parser->lexer);
@ -18242,12 +18246,7 @@ cp_parser_parameter_declaration_clause (cp_parser* parser)
parameter-declaration-list, then the entire
parameter-declaration-clause is erroneous. */
if (is_error)
{
/* Unwind generic function template scope if necessary. */
if (parser->fully_implicit_function_template_p)
finish_fully_implicit_template (parser, /*member_decl_opt=*/0);
return NULL;
}
return NULL;
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);

View File

@ -1,3 +1,8 @@
2014-03-08 Adam Butcher <adam@jessamine.co.uk>
PR c++/60393
* g++.dg/cpp1y/pr60393.C: New testcase.
2014-03-08 Dominique d'Humieres <dominiq@lps.ens.fr>
PR libfortran/60128

View File

@ -0,0 +1,9 @@
// PR c++/60393
// { dg-options -std=c++1y }
void (*f)(auto) + 0; // { dg-error "expected" }
struct A
{
int i;
};