https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92232
Bug ID: 92232 Summary: [C++17] Unable to deduce template function parameter Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: daniel at hebirobotics dot com Target Milestone: --- When trying to use a function pointer (which has a non-void return type and one or more parameters) as a template argument parameter - whose return type is specified as `auto` and one of its arguments is dependent on another template typename - GCC fails to deduce the function template parameter. A simplified use case is as followed: --- enum MyEnumT {}; struct MyStructDecl; typedef MyStructDecl* MyStructDeclPtr; MyEnumT myFunc(MyStructDeclPtr, int someArg); template<typename FirstArgT, auto(*functor)(FirstArgT, int)> void deducer(FirstArgT arg, int i) { auto ret = functor(arg, i); // Something } int main() { deducer<MyStructDeclPtr, myFunc>(nullptr, 12); } --- Some interesting and potentially relevant notes: * If you change the problematic template function parameter (`auto(*functor)(FirstArgT, int)`) to have a `MyEnumT` return type (`MyEnumT(*functor)(FirstArgT, int)`), the code will compile * If you change the problematic template function parameter to accept a non-template typename as the first parameter (`auto(*functor)(MyStructDeclPtr, int)`), the code will compile. I've seen this as an issue on 9.1 and 9.2, but I assume it to be an issue for any version which can utilize C++17. This code compiles without any issues on both Clang and MSVC ( https://gcc.godbolt.org/z/EIcOJc ).