https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97096
Bug ID: 97096 Summary: ICE on invalid: in register_constexpr_fundef, on out-of-line-defaulted operator== or operator<=> Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: arthur.j.odwyer at gmail dot com Target Milestone: --- // https://godbolt.org/z/neqx1q cat >test.cpp <<EOF namespace std { class strong_ordering { static const strong_ordering less; static const strong_ordering equal; static const strong_ordering equivalent; static const strong_ordering greater; }; } struct S { friend bool operator==(S, S) = default; }; bool operator==(S, S) noexcept = default; EOF g++ -std=c++20 test.cpp test.cpp: In function 'constexpr bool operator==(S, S)': test.cpp:13:6: internal compiler error: in register_constexpr_fundef, at cp/constexpr.c:932 14 | bool operator==(S, S) noexcept = default; | ^~~~~~~~ 0x1b74f49 internal_error(char const*, ...) ???:0 0x686ceb fancy_abort(char const*, int, char const*) ???:0 0x6f7903 register_constexpr_fundef(tree_node*, tree_node*) ???:0 0x7799a7 finish_function(bool) ???:0 0x7f1d8b synthesize_method(tree_node*) ???:0 0x77cf76 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ???:0 0x862bdc c_parse_file() ???:0 0x9d34f2 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. The same ICE happens if you replace both instances of `==` with `<=>`.