[Bug c++/83672] New: Unable to take the address of a template function parameter pack specialization with a function argument

smw at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 3 18:28:00 GMT 2018


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

            Bug ID: 83672
           Summary: Unable to take the address of a template function
                    parameter pack specialization with a function argument
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: smw at gcc dot gnu.org
  Target Milestone: ---

Can't take the address of a template function specialization if the template
function has a parameter pack and one of the arguments to the parameter pack
expansion is a function type-id.

Without resorting to further word torture, an example might clarify.

template <typename ...PP>
  void f01(PP...)
  { }

int f00() { return 0; }

int
main()
{
  f01<int()>(f00); // OK, call specialization

  void (*fp01)(int) = f01<int>; // OK, address of int specialization
  void (*fp02)(int()) = f01<int(*)()>; // compiles OK, but, um...
  void (*fp03)(int()) = f01<int()>; // nope nope nope
}


14 : <source>:14:25: error: no matches converting function 'f01' to type 'void
(*)(int (*)())'
   void (*fp03)(int()) = f01<int()>; // nope nope nope
                         ^~~~~~~~~~
2 : <source>:2:8: note: candidate is: template<class ... PP> void f01(PP ...)
   void f01(PP...)
        ^~~


Please note that clang5 and ICC18 both accept this code.


More information about the Gcc-bugs mailing list