diff mbox

[C++] PR 67318 ("[6 regression] Parsing error when using abbreviated integral type names in template parameter pack declaration")

Message ID 55F0A094.4040609@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Sept. 9, 2015, 9:11 p.m. UTC
... what about something this simple? Passes testing...

Thanks,
Paolo.

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

Comments

Jason Merrill Sept. 10, 2015, 1:18 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 227600)
+++ cp/parser.c	(working copy)
@@ -19626,11 +19626,12 @@  cp_parser_parameter_declaration (cp_parser *parser
       if (type && DECL_P (type))
         type = TREE_TYPE (type);
 
-      if (type
-	  && TREE_CODE (type) != TYPE_PACK_EXPANSION
-	  && declarator_can_be_parameter_pack (declarator)
-          && (template_parm_p || uses_parameter_packs (type)))
-        {
+      if (((type
+	    && TREE_CODE (type) != TYPE_PACK_EXPANSION
+	    && (template_parm_p || uses_parameter_packs (type)))
+	   || (!type && template_parm_p))
+	  && declarator_can_be_parameter_pack (declarator))
+	{
 	  /* Consume the `...'. */
 	  cp_lexer_consume_token (parser->lexer);
 	  maybe_warn_variadic_templates ();
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;