]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/60377 ([c++1y] ICE with invalid function parameter in conjunction with...
authorAdam Butcher <adam@jessamine.co.uk>
Sat, 1 Mar 2014 21:28:18 +0000 (21:28 +0000)
committerAdam Butcher <abutcher@gcc.gnu.org>
Sat, 1 Mar 2014 21:28:18 +0000 (21:28 +0000)
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

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/pr60377.C [new file with mode: 0644]

index 4b6682ad50a41119aa17b4a51322a9310787daa7..2d8364b6c4f230a07dd71648a2c7e113255c8343 100644 (file)
@@ -1,3 +1,9 @@
+2014-03-01  Adam Butcher  <adam@jessamine.co.uk>
+
+       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  <paolo.carlini@oracle.com>
 
        * method.c (implicitly_declare_fn): Remove redundant
index ef363274471ccc6dc5d7d555fe3a47dcab58bfff..8c7826244b3ff52d6d8e5b51ff6d6eb86af635b0 100644 (file)
@@ -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);
index dd9dcbae1d1bc796eb6d336a7716124c2bcbadd3..2f0563835959e6a40520d5401d869b28c2623b6b 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-01  Adam Butcher  <adam@jessamine.co.uk>
+
+       PR c++/60377
+       * g++.dg/cpp1y/pr60377.C: New testcase.
+
 2014-03-01  Mikael Morin  <mikael@gcc.gnu.org>
 
        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 (file)
index 0000000..4f6497c
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/60377
+// { dg-options -std=c++1y }
+
+void foo(auto, void (f*)()); // { dg-error "expected" }
+
+struct A
+{
+  int i;
+};
This page took 0.094681 seconds and 5 git commands to generate.