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

            Bug ID: 64194
           Summary: [C++14] <unresolved overloaded function type> for
                    function template with auto return
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

template <typename Tp> auto id() { }

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

int main()
{
    // id<int>;
    g(id<int>);
}

G++ fails to resolve id<int> in the call.

over.cc: In function ‘int main()’:
over.cc:8:14: error: no matching function for call to ‘g(<unresolved overloaded
function type>)’
     g(id<int>);
              ^
over.cc:3:28: note: candidate: template<class T> void g(T)
 template <typename T> void g(T) { }
                            ^
over.cc:3:28: note:   template argument deduction/substitution failed:
over.cc:8:14: note:   couldn't deduce template parameter ‘T’
     g(id<int>);
              ^

It works if the reference to id<int> is uncommented, or if auto id() is changed
to void id()

Reply via email to