$ cat testcase.C template<typename... Ts> void foo(Ts...); int main() { void (*f)(int*) = foo<int[]>; } $ g++ -std=c++11 testcase.C testcase.C: In function ‘int main()’: testcase.C:6:21: error: no matches converting function ‘foo’ to type ‘void (*)(int*)’ 6 | void (*f)(int*) = foo<int[]>; | ^~~~~~~~~~ testcase.C:2:6: note: candidate is: ‘template<class ... Ts> void foo(Ts ...)’ 2 | void foo(Ts...); | ^~~ But if we replace the template parameter pack Ts with an ordinary template parameter T then the testcase compiles successfully. The fact that we perform array-to-pointer decaying of "int[]" after substituting into the function parameter pack seems to be relevant here.
Confirmed.
I believe this case of no specialization matching error is related with this bug(clang passed, MSVC++ failed like GCC https://godbolt.org/z/KTahxj868). Possibly it is a duplicate case. However, I can see even though the root cause are all from template substitution, the "implicit_convert" and "determine_specialization" are two different path. Should we dup this or create a new, considering the fix might be quite different in these two cases? Do we force developper to fix both cases when submitting a patch? template<typename ...Ts> void foo(Ts...); template<> void foo<int[]>(int*){} <source>:3:19: error: no matches converting function 'foo' to type 'void (*)(int*)' 3 | void (*f)(int*) = foo<int[]>; | ^~~~~~~~~~ <source>:2:6: note: candidate is: 'template<class ... Ts> void foo(Ts ...)' 2 | void foo(Ts...); | ^~~ <source>:5:6: error: template-id 'foo<int [3]>' for 'void foo(int*)' does not match any template declaration 5 | void foo<int[3]>(int*){} | ^~~~~~~~~~~ <source>:2:6: note: candidate is: 'template<class ... Ts> void foo(Ts ...)' 2 | void foo(Ts...); | ^~~