https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59655
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- Another testcase, this time from Bug 85936: template <class a> void f(int, a); template <class a, class c> void g(int, a &&e, c) { f(0, [=] { e; }); } void h() { g(0, h, 0); } d.cc:1:25: error: ‘void f(int, a) [with a = g(int, a&&, c) [with a = void (&)(); c = int]::<lambda()>]’, declared using local type ‘g(int, a&&, c) [with a = void (&)(); c = int]::<lambda()>’, is used but never defined [-fpermissive] template <class a> void f(int, a); ^ I'm not sure this one really is valid though. Clang doesn't complain, and will link successfully if another TU instantiates g<void(&)(), int> and has a definition for f<g::[lambda]> e.g. in another TU: template <class a> void f(int, a) { } template <class a, class c> void g(int, a &&e, c) { f(0, [=] { e; }); } void i() { g(0, i, 0); }