https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93807
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Keywords|accepts-invalid | CC| |mpolacek at gcc dot gnu.org Last reconfirmed| |2020-04-21 Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org --- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- I think this is valid code: C++20 [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. So the declaration isn't needed to treat "operator==<T>" as a template-id. I'll add the test.