From: Jason Merrill Date: Wed, 18 Jun 2014 22:13:40 +0000 (-0400) Subject: re PR c++/61507 (GCC does not compile function with parameter pack.) X-Git-Tag: releases/gcc-5.1.0~6779 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3dc80be5eea6667a4dd7b2f2a52108d9c4ea06a;p=thirdparty%2Fgcc.git re PR c++/61507 (GCC does not compile function with parameter pack.) PR c++/61507 * pt.c (resolve_overloaded_unification): Preserve ARGUMENT_PACK_EXPLICIT_ARGS. From-SVN: r211808 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9b4818ed971f..74eefeaec1d1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-06-18 Jason Merrill + + PR c++/61507 + * pt.c (resolve_overloaded_unification): Preserve + ARGUMENT_PACK_EXPLICIT_ARGS. + 2014-06-18 Jakub Jelinek * cp-gimplify.c (cxx_omp_finish_clause): Add a gimple_seq * diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d5cc2576f9de..f0a598beff8d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -16838,7 +16838,16 @@ resolve_overloaded_unification (tree tparms, int i = TREE_VEC_LENGTH (targs); for (; i--; ) if (TREE_VEC_ELT (tempargs, i)) - TREE_VEC_ELT (targs, i) = TREE_VEC_ELT (tempargs, i); + { + tree old = TREE_VEC_ELT (targs, i); + tree new_ = TREE_VEC_ELT (tempargs, i); + if (new_ && old && ARGUMENT_PACK_P (old) + && ARGUMENT_PACK_EXPLICIT_ARGS (old)) + /* Don't forget explicit template arguments in a pack. */ + ARGUMENT_PACK_EXPLICIT_ARGS (new_) + = ARGUMENT_PACK_EXPLICIT_ARGS (old); + TREE_VEC_ELT (targs, i) = new_; + } } if (good) return true; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic159.C b/gcc/testsuite/g++.dg/cpp0x/variadic159.C new file mode 100644 index 000000000000..2b14d3005f01 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic159.C @@ -0,0 +1,14 @@ +// PR c++/61507 +// { dg-do compile { target c++11 } } + +struct A { + void foo(const int &); + void foo(float); +}; + +template +void bar(void (A::*memfun)(Args...), Args... args); + +void go(const int& i) { + bar(&A::foo, i); +}