This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR c++/60377.
- From: Adam Butcher <adam at jessamine dot co dot uk>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jason Merrill <jason at redhat dot com>, Volker Reichelt <reichelt at gcc dot gnu dot org>, Adam Butcher <adam at jessamine dot co dot uk>
- Date: Sat, 1 Mar 2014 20:30:35 +0000
- Subject: [PATCH] Fix PR c++/60377.
- Authentication-results: sourceware.org; auth=none
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.
---
gcc/cp/parser.c | 7 ++++++-
gcc/testsuite/g++.dg/cpp1y/pr60377.C | 9 +++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr60377.C
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index ef36327..8c78262 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/g++.dg/cpp1y/pr60377.C b/gcc/testsuite/g++.dg/cpp1y/pr60377.C
new file mode 100644
index 0000000..4f6497c
--- /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;
+};
--
1.9.0