From: Adam Butcher Date: Sat, 1 Mar 2014 21:28:18 +0000 (+0000) Subject: re PR c++/60377 ([c++1y] ICE with invalid function parameter in conjunction with... X-Git-Tag: releases/gcc-4.9.0~616 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=234b1504b16d0a273c9dac3698628c6d577d35eb;p=thirdparty%2Fgcc.git re PR c++/60377 ([c++1y] ICE with invalid function parameter in conjunction with auto parameter) Fix PR c++/60377. PR c++/60377 * parser.c (cp_parser_parameter_declaration_clause): Unwind generic function scope on parse error in function parameter list. PR c++/60377 * g++.dg/cpp1y/pr60377.C: New testcase. From-SVN: r208250 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4b6682ad50a4..2d8364b6c4f2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-03-01 Adam Butcher + + PR c++/60377 + * parser.c (cp_parser_parameter_declaration_clause): Unwind generic + function scope on parse error in function parameter list. + 2014-03-01 Paolo Carlini * method.c (implicitly_declare_fn): Remove redundant diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index ef363274471c..8c7826244b3f 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -18208,7 +18208,12 @@ cp_parser_parameter_declaration_clause (cp_parser* parser) parameter-declaration-list, then the entire parameter-declaration-clause is erroneous. */ if (is_error) - return NULL; + { + /* 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; + } /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dd9dcbae1d1b..2f0563835959 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-01 Adam Butcher + + PR c++/60377 + * g++.dg/cpp1y/pr60377.C: New testcase. + 2014-03-01 Mikael Morin PR fortran/60341 diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60377.C b/gcc/testsuite/g++.dg/cpp1y/pr60377.C new file mode 100644 index 000000000000..4f6497c5e052 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60377.C @@ -0,0 +1,9 @@ +// PR c++/60377 +// { dg-options -std=c++1y } + +void foo(auto, void (f*)()); // { dg-error "expected" } + +struct A +{ + int i; +};