https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93807
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:edfa7c684d329708dcee733fcb552bed9d931621 commit r10-7894-gedfa7c684d329708dcee733fcb552bed9d931621 Author: Marek Polacek <pola...@redhat.com> Date: Tue Apr 21 18:11:33 2020 -0400 c++: Add test for c++/93807 This PR was initially accepts-invalid, but I think it's actually valid C++20 code. My reasoning is that in C++20 we no longer require the declaration of operator== (#if-defed in the test), because C++20's [temp.names]/2 says "A name is also considered to refer to a template if it is an unqualified-id followed by a < and name lookup either finds one or more functions or finds nothing." so when we're parsing constexpr friend bool operator==<T>(T lhs, const Foo& rhs); we treat "operator==" as a template name, because name lookup of "operator==" found nothing and we have an operator-function-id, which is an unqualified-id, and it's followed by a <. So the declaration isn't needed to treat "operator==<T>" as a template-id. PR c++/93807 * g++.dg/cpp2a/fn-template20.C: New test.