https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108948
Bug ID: 108948 Summary: <unresolved overloaded function type> for function template with auto return and parameter pack Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: egpt.gcc at wolke7 dot net Target Milestone: --- Hello, consider the following code (with -std=c++17): ------------------------------------------------------------------ #include <tuple> template <typename... Types> auto add1(const Types... x) { return std::make_tuple((x+1)...); } int main() { auto x = std::apply(add1<int,int>, std::make_tuple(10,20)); return 0; } ------------------------------------------------------------------ Compiling with g++ 12.2.0 (Debian testing) yields the following error message: ------------------------------------------------------------------ add1.cpp: In function 'int main()': add1.cpp:11:29: error: invalid initialization of non-const reference of type 'std::tuple<int, int> (&)(int, int)' from an rvalue of type '<unresolved overloaded function type>' 11 | auto x = std::apply(add1<int,int>, t); | ^~~~~~~~~~~~~ ------------------------------------------------------------------ Both, clang++ 14.0.6 (Debian testing) and icpx 2023.0.0 compile just fine. It seems related to the resolved bug 64194. It works with add1 being defined without parameter pack as follows: ------------------------------------------------------------------ template <typename Type1, typename Type2> auto add1(const Type1 x, const Type2 y) { return std::make_tuple(x+1,y+1); } ------------------------------------------------------------------ Kind regards Elmar