https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81700
Bug ID: 81700 Summary: Unresolved function type when taking address of operator() of generic lambda Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gufideg at gmail dot com Target Milestone: --- Hi, have found this corner case when taking the address of operator() of a generic lambda. This error only happen when using decltype with a function defined as follow: // Take a type, return that same type template<typename T> T identity(T); int main() { auto f = [](auto test) {}; using F = decltype(f); // Error! Unresolved function type? (void)decltype(identity(&F::operator()<int>)){}; } However, taking the address of the lambda beforehand make GCC accept the code: // Take a type, return that same type template<typename T> T identity(T); int main() { auto f = [](auto test) {}; using F = decltype(f); // We simply add this line (void)decltype(&F::operator()<int>){}; // Compiles! (void)decltype(identity(&F::operator()<int>)){}; } Here's a live example: http://coliru.stacked-crooked.com/a/b7909605e2f882c9 Note that this bug don't happen with non-generic lambdas.