https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105667
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- here is one which removes the inner lamba to just a templated function inside a template struct: template<auto f> struct h {typedef int type;}; template<class Types> struct t{}; template<typename Ts> struct crash { using Types = typename h<[]() {}>::type; template<int tt> static void f() { using type = t<Types>; }; }; int main() { crash<int>{}.f<1>(); return 0; }