Hi,

I tracked down this regression to r225621, a clean up committed by Jason a while ago: unless we want to try something more aggressive, we can fix it the regression by simply restoring a few lines in cp_parser_template_parameter which consume the ellipsis. To clarify implementation-wise, the types affected are essentially all those for which cp_parser_simple_type_specifier (thus cp_parser_parameter_declaration) doesn't set the type in decl_specs:

      if (decl_specs
      && (token->keyword != RID_SIGNED
          && token->keyword != RID_UNSIGNED
          && token->keyword != RID_SHORT
          && token->keyword != RID_LONG))
    cp_parser_set_decl_spec_type (decl_specs,
                      type,
                      token,
                      /*type_definition_p=*/false);

Weird that we didn't have any testcase!

Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////////



/cp
2015-09-09  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/67318
        * parser.c (cp_parser_template_parameter): Revert a few lines of
        r225621: consume the ellipsis and set *is_parameter_pack to true.

/testsuite
2015-09-09  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/67318
        * g++.dg/cpp0x/variadic166.C: New.
Index: cp/parser.c
===================================================================
--- cp/parser.c (revision 227586)
+++ cp/parser.c (working copy)
@@ -13811,6 +13811,20 @@ cp_parser_template_parameter (cp_parser* parser, b
        /* Consume the `...' for better error recovery.  */
        cp_lexer_consume_token (parser->lexer);
     }
+  /* If the next token is an ellipsis, and we don't already have it
+     marked as a parameter pack, then we have a parameter pack (that
+     has no declarator).  */
+  else if (!*is_parameter_pack
+          && cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)
+          && (declarator_can_be_parameter_pack
+              (parameter_declarator->declarator)))
+    {
+      /* Consume the `...'.  */
+      cp_lexer_consume_token (parser->lexer);
+      maybe_warn_variadic_templates ();
+      
+      *is_parameter_pack = true;
+    }
 
   // The parameter may have been constrained.
   if (is_constrained_parameter (parameter_declarator))
Index: testsuite/g++.dg/cpp0x/variadic166.C
===================================================================
--- testsuite/g++.dg/cpp0x/variadic166.C        (revision 0)
+++ testsuite/g++.dg/cpp0x/variadic166.C        (working copy)
@@ -0,0 +1,14 @@
+// PR c++/67318
+// { dg-do compile { target c++11 } }
+
+template<signed...>
+struct MyStruct1;
+
+template<unsigned...>
+struct MyStruct2;
+
+template<short...>
+struct MyStruct3;
+
+template<long...>
+struct MyStruct4;

Reply via email to