https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114349
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:8651991fe2ea90a7276e91673b15b5c3865f14d7 commit r14-9659-g8651991fe2ea90a7276e91673b15b5c3865f14d7 Author: Marek Polacek <pola...@redhat.com> Date: Fri Mar 15 09:23:28 2024 -0400 c++: ICE with noexcept and local specialization, again [PR114349] Patrick noticed that my r14-9339-gdc6c3bfb59baab patch is wrong; we're dealing with a noexcept-spec there, not a noexcept-expr, so setting cp_noexcept_operand et al is incorrect. Back to the drawing board then. To fix noexcept84.C, we should probably avoid doing push_to_top_level in certain cases. maybe_push_to_top_level didn't work here as-is, so I changed it to not push to top level if decl_function_context is non-null, when we are not dealing with a lambda. This also fixes c++/114349, introduced by r14-9339. PR c++/114349 gcc/cp/ChangeLog: * name-lookup.cc (maybe_push_to_top_level): For a non-lambda, don't push to top level if decl_function_context is non-null. * pt.cc (maybe_instantiate_noexcept): Use maybe_push_to_top_level. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/noexcept85.C: New test. * g++.dg/cpp0x/noexcept86.C: New test.