diff mbox

C++ PATCH for c++/64514 (zero-length fixed parameter pack)

Message ID 54B58383.2070708@redhat.com
State New
Headers show

Commit Message

Jason Merrill Jan. 13, 2015, 8:43 p.m. UTC
The code I added for dealing with fixed parameter packs wasn't dealing 
properly with zero-length packs: if there were any elements we would see 
the pack expansion argument and punt, but we need to do that in the 
zero-length case as well.

Tested x86_64-pc-linux-gnu, applying to trunk and 4.9.
diff mbox

Patch

commit 8fa00de341538399cd675d50a6b1cb86bda39159
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Jan 12 22:00:26 2015 -0500

    	PR c++/64514
    	* pt.c (coerce_template_parameter_pack): Return NULL for a
    	zero-length fixed parameter pack with a pack expansion arg.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3ac93db..55871e5 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6825,6 +6825,9 @@  coerce_template_parameter_pack (tree parms,
               if (invalid_nontype_parm_type_p (t, complain))
                 return error_mark_node;
             }
+	  /* We don't know how many args we have yet, just
+	     use the unconverted ones for now.  */
+	  return NULL_TREE;
         }
 
       packed_args = make_tree_vec (TREE_VEC_LENGTH (packed_parms));
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic165.C b/gcc/testsuite/g++.dg/cpp0x/variadic165.C
new file mode 100644
index 0000000..862931f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic165.C
@@ -0,0 +1,17 @@ 
+// PR c++/64514
+// { dg-do compile { target c++11 } }
+
+template<typename... T>
+struct Functor
+{
+    template <T...>
+    struct Inner
+    {};
+};
+
+template struct Functor<>::Inner<>;
+
+int main()
+{
+
+}