commit 00e76793666566b604903930c77d4a644ec74a12
Author: Jason Merrill <jason@redhat.com>
Date: Tue Jun 17 16:35:57 2014 +0200
PR c++/61507
* pt.c (resolve_overloaded_unification): Preserve
ARGUMENT_PACK_EXPLICIT_ARGS.
@@ -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;
new file mode 100644
@@ -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);
+}