https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111831
Bug ID: 111831 Summary: friend with requires keyword compilation error Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janezz55 at gmail dot com Target Milestone: --- If I compile list.cpp with: g++ -std=c++20 list.cpp -o l friend auto operator==(list const& l, list const& r) noexcept(noexcept( std::equal(l.begin(), l.end(), r.begin(), r.end()) ) ) requires(requires{std::equal(l.begin(), l.end(), r.begin(), r.end());}) { return std::equal(l.begin(), l.end(), r.begin(), r.end()); } gcc-13.2.1 will respond with a compilation error: error: no match for 'operator==' (operand types are 'xl::list<int>' and 'xl::list<int>') 51 | std::cout << a.size() << " " << b.size() << " " << (a == b) << std::endl; | ~ ^~ ~ | | | | | list<[...]> | list<[...]> bug clang-16.0.6 won't. I think the bug is related to the friend declaration. I have prepared an example: https://github.com/user1095108/xl/blob/master/list.cpp The relevant requires inside list.hpp is commented out, since the requires serves no purpose at all in this case. Please uncomment, if you decide to investigate.