https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108242
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Sorry, above doesn't compile, but template<class F> void my_fun() { auto fun = [&](auto res) { static constexpr char const* fun_name = __PRETTY_FUNCTION__; struct { constexpr const char* operator()() const { constexpr char const* fun_name2 = __PRETTY_FUNCTION__; return fun_name; }; } t; t(); }; fun(12); } int main() { my_fun<int>(); } ICEs and compiles fine with G++ 11.x.