]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60391 ([c++1y] ICE with auto parameter for operator"")
authorAdam Butcher <adam@jessamine.co.uk>
Mon, 17 Mar 2014 20:02:16 +0000 (20:02 +0000)
committerAdam Butcher <abutcher@gcc.gnu.org>
Mon, 17 Mar 2014 20:02:16 +0000 (20:02 +0000)
Fix PR c++/60391

PR c++/60391
* parser.c (cp_parser_skip_to_end_of_block_or_statement): Unwind generic
function scope as per cp_parser_skip_to_end_of_statement.

PR c++/60391
* g++.dg/cpp1y/pr60391.C: New testcase.

From-SVN: r208624

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

index 5b52060720ed2271445ce936c71325a71a21d130..a240ad9ec765eb67ddcf3d6ec1b23d7f3469ebc8 100644 (file)
@@ -1,3 +1,9 @@
+2014-03-17  Adam Butcher  <adam@jessamine.co.uk>
+
+       PR c++/60391
+       * parser.c (cp_parser_skip_to_end_of_block_or_statement): Unwind generic
+       function scope as per cp_parser_skip_to_end_of_statement.
+
 2014-03-17  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/59571
index a3c8d7ecb3f96389248a79a18185eb0d9758c303..519e2090dd29e1a9449def315dfb4a793da52988 100644 (file)
@@ -3225,6 +3225,10 @@ cp_parser_skip_to_end_of_block_or_statement (cp_parser* parser)
 {
   int 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 (nesting_depth >= 0)
     {
       cp_token *token = cp_lexer_peek_token (parser->lexer);
index e887fb193af2a48dc578597893ff0e855e175ccb..a327e94bcd5864fe9e5358778375527c5f7ba2f8 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-17  Adam Butcher  <adam@jessamine.co.uk>
+
+       PR c++/60391
+       * g++.dg/cpp1y/pr60391.C: New testcase.
+
 2014-03-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/60516
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60391.C b/gcc/testsuite/g++.dg/cpp1y/pr60391.C
new file mode 100644 (file)
index 0000000..68746ae
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/60391
+// { dg-do compile { target c++1y } }
+// { dg-options "" }
+
+namespace N
+{
+  int operator"" _X(auto) {} // { dg-error "invalid" }
+}
+
+namespace N {}