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

            Bug ID: 89633
           Summary: Inner class cannot pass a lambda to a template
                    function in outer class
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: raphael.kubo.da.costa at intel dot com
  Target Milestone: ---

The following excerpt builds fine on MSVC, ICC and clang:

struct S {
  template <typename Function>
  void frob(const Function&);

  struct T {
    T(S* s) {
      s->frob([]() {});
    }
  };
};

but GCC fails with

<source>:3:8: error: 'void S::frob(const Function&) [with Function =
S::T::T(S*)::<lambda()>]', declared using local type 'const
S::T::T(S*)::<lambda()>', is used but never defined [-fpermissive]
    3 |   void frob(const Function&);
      |        ^~~~

Passing anything other than a lambda to S::frob(), or making it take a function
pointer rather than a template argument, works.

Reply via email to