https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110107
Bug ID: 110107 Summary: ICE on invalid code with lambda Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: stevenxia990430 at gmail dot com Target Milestone: --- The following invalid program produces internal compiler error: error reporting routines re-entered. Tested on GCC-trunk. Apologies that it might be complex, I had a hard time trying to reduce the small code snippet. To quickly reproduce: https://gcc.godbolt.org/z/rdfvaEbP5 ``` #include <utility> using namespace std; template <class T> auto make_safe(T lambda) -> decltype([](auto&&... args){return lambda(args...);}) { try { return [lambda = std::forward<T>(lambda)](auto&&... args) -> decltype(lambda(args...)){ return lambda(std::forward<decltype(args)>(args)...); }; } catch(...){} } int main() { auto safef = make_safe([]() { return 0; }); return 0; } ```