将函数模板特化传递给可变参数模板函数

HC4*_*ica 7 c++ templates template-function variadic-templates c++11

我将函数模板特化的地址传递给常规模板函数没有问题:

template <typename T>
void f(T) {}

template <typename A, typename B>
void foo(A, B) {}

int main()
{
    foo(&f<int>, &f<float>);
}
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试将相同的特化传递给可变参数模板时:

template <typename T>
void f(T) {}

template <typename... A>
void bar(A...) {}

int main()
{
    bar(&f<int>, &f<float>);
}
Run Code Online (Sandbox Code Playgroud)

我用GCC得到了以下编译器错误(我试过4.6.1和4.7.0):

test.cpp: In function 'int main()':
test.cpp:9:27: error: no matching function for call to 'bar(<unresolved overloaded function type>, <unresolved overloaded function type>)'
test.cpp:9:27: note: candidate is:
test.cpp:5:6: note: template<class ... A> void bar(A ...)
test.cpp:5:6: note:   template argument deduction/substitution failed:
Run Code Online (Sandbox Code Playgroud)

为什么我会收到这些错误?

Pet*_*der 5

看起来它可能是GCC中的一个可能在GCC 4.6.2中修复错误(我说可能是因为它不完全相同,但确实涉及获取可变参数模板函数的地址).