aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c11
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic159.C14
3 files changed, 30 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9b4818e..74eefea 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/61507
+ * pt.c (resolve_overloaded_unification): Preserve
+ ARGUMENT_PACK_EXPLICIT_ARGS.
+
2014-06-18 Jakub Jelinek <jakub@redhat.com>
* cp-gimplify.c (cxx_omp_finish_clause): Add a gimple_seq *
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d5cc257..f0a598b 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 0000000..2b14d30
--- /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 <typename... Args>
+void bar(void (A::*memfun)(Args...), Args... args);
+
+void go(const int& i) {
+ bar<const int &>(&A::foo, i);
+}