]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60393 ([c++1y] ICE with with invalid functions with auto parameters)
authorAdam Butcher <adam@jessamine.co.uk>
Sat, 8 Mar 2014 09:33:03 +0000 (09:33 +0000)
committerAdam Butcher <abutcher@gcc.gnu.org>
Sat, 8 Mar 2014 09:33:03 +0000 (09:33 +0000)
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

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

index 83a35859e3da63f5f301656d2aefc97ea6f65a0a..07ac2b27f0aabed221c132d05398a46d41ac3766 100644 (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.
index 572528358f5bcfc6cf694ef9b180b4bf14328055..64583ba98bdae88da19719c1bdf6451e50621567 100644 (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);
index e46a9fc913b4d8a27bc75ebe57f1cb91b92a4eca..9a0b752e001b37bd05464791865841ba1be8ea3c 100644 (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
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60393.C b/gcc/testsuite/g++.dg/cpp1y/pr60393.C
new file mode 100644 (file)
index 0000000..38b8b91
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/60393
+// { dg-options -std=c++1y }
+
+void (*f)(auto) + 0; // { dg-error "expected" }
+
+struct A
+{
+  int i;
+};