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

            Bug ID: 96361
           Summary: return type not deduced for a function template
                    specialization given as argument of a template
                    function
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: okannen at gmail dot com
  Target Milestone: ---

This bug exist since GCC 6.1 and is still present in version GCC 10.2

The following code should compile:

template <class T>
auto f(T v){
  return v+v;
}

template <class T>
void g(T && v);

void h(){
  g(f<int>);  //Error
}

GCC error message is: no matching function for call to 'g(<unresolved
overloaded function type>)'

There is no error if the return type of f is not deduced or if some code
is used to force the return type deduction. For exemple if the function h is
changed to:

void h(){
  using x  = decltype (f<int>);
  g(f<int>); // No error
}

the code compile.

Reply via email to