https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96533
Bug ID: 96533 Summary: ICE with -Wunused-parameter when using three-way comparison Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: natattak at gmail dot com Target Milestone: --- Minimal example: #include <compare> #include <functional> struct S { // making it a member fixes the issue friend auto operator<=>(S, S) = default; }; // removing 'rhs' fixes the issue template <typename Lhs, typename Rhs> auto operator<(Lhs&&, Rhs&& rhs) { return true; } int main() { // using operator< directly fixes the issue //return S{} < S{}; return std::less{}(S{}, S{}); } Compiled with `g++ -std=c++20 -Wunused-parameter`. Output: ' Internal compiler error: Error reporting routines re-entered. Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. First noticed on g++ 10.1, tested on compiler explorer with current trunk: https://godbolt.org/z/85j8TW