https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85554
Bug ID: 85554 Summary: GCC does not instantiate template function when only used as a function type Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: me at adhokshajmishraonline dot in Target Milestone: --- Proof of concept: ================= template<typename T> auto make_value(){ return T{}; } template<typename F> auto call(F func){ return func(); } int main(){ auto result = call(make_value<double>); return 0; } Compiling with G++ ================== ╭─ adhokshajmishra@andromeda in /tmp ╰─➤ g++ --version g++ (GCC) 7.3.1 20180406 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ╭─ adhokshajmishra@andromeda in /tmp ╰─➤ g++ test.cpp -o test -std=c++17 test.cpp: In function ‘int main()’: test.cpp:12:42: error: no matching function for call to ‘call(<unresolved overloaded function type>)’ auto result = call(make_value<double>); ^ test.cpp:7:6: note: candidate: template<class F> auto call(F) auto call(F func){ ^~~~ test.cpp:7:6: note: template argument deduction/substitution failed: test.cpp:12:42: note: couldn't deduce template parameter ‘F’ auto result = call(make_value<double>); ^ Compiling with Clang: no error As per [http://eel.is/c++draft/temp#inst-4.sentence-1], GCC seems to be wrong here.