]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/59989 (ICE when a template parameter pack is explicitly specified for a...
authorJason Merrill <jason@redhat.com>
Wed, 29 Jan 2014 22:12:09 +0000 (17:12 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 29 Jan 2014 22:12:09 +0000 (17:12 -0500)
PR c++/59989
* pt.c (expand_template_argument_pack): Correct
non_default_args_count calculation.

From-SVN: r207285

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/variadic148.C [new file with mode: 0644]

index e24a9aea8c744653401df792615d9b8b222ac185..858272ffc8d38f7d575ca0e73895e8b1f9bc381c 100644 (file)
@@ -1,5 +1,9 @@
 2014-01-29  Jason Merrill  <jason@redhat.com>
 
+       PR c++/59989
+       * pt.c (expand_template_argument_pack): Correct
+       non_default_args_count calculation.
+
        PR c++/58466
        * pt.c (unify_pack_expansion): Call expand_template_argument_pack.
 
index 9be91711e5575a4c305e3f11f945e9dbd9b0fc57..c9c6b379bf6ff54a7d1930f1b6054c34f066eda5 100644 (file)
@@ -3471,7 +3471,7 @@ expand_template_argument_pack (tree args)
           for (i = 0; i < num_packed; ++i, ++out_arg)
             TREE_VEC_ELT (result_args, out_arg) = TREE_VEC_ELT(packed, i);
          if (non_default_args_count > 0)
-           non_default_args_count += num_packed;
+           non_default_args_count += num_packed - 1;
         }
       else
         {
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic148.C b/gcc/testsuite/g++.dg/cpp0x/variadic148.C
new file mode 100644 (file)
index 0000000..a4ee635
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/59989
+// { dg-require-effective-target c++11 }
+
+template<typename T> struct X {};
+template<template<typename...> class D, typename ...U> int test(D<U...>*);
+int n = test<X, int>(0);       // { dg-error "no match" }