https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94501

            Bug ID: 94501
           Summary: bogus "no matches converting function ... to type ..."
                    error with variadic function template
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

$ 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.

Reply via email to