diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e24a9aea8c7..858272ffc8d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-01-29 Jason Merrill + 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. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9be91711e55..c9c6b379bf6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 index 00000000000..a4ee63533da --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic148.C @@ -0,0 +1,6 @@ +// PR c++/59989 +// { dg-require-effective-target c++11 } + +template struct X {}; +template class D, typename ...U> int test(D*); +int n = test(0); // { dg-error "no match" }