https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94583
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- We crash on the assert in get_defaulted_eh_spec: 2417 if (sfk == sfk_comparison) 2418 { 2419 /* We're in synthesize_method. Start with NULL_TREE, build_comparison_op 2420 will adjust as needed. */ 2421 gcc_assert (decl == current_function_decl); 2422 return NULL_TREE; 2423 } https://eel.is/c++draft/class.compare#default-5 seems to be relevant: If the three-way comparison operator function has no noexcept-specifier, the implicitly-declared == operator function has an implicit exception specification ([except.spec]) that may differ from the implicit exception specification of the three-way comparison operator function. [except.spec]/11 The exception specification for a comparison operator function ([over.binary]) without a noexcept-specifier that is defaulted on its first declaration is potentially-throwing if and only if any expression in the implicit definition is potentially-throwing. The implicit operator== has noexcept_deferred_spec, and unfortunately synthesized_method_walk doesn't seem to work on sfk_comparison.