https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107324
Bug ID: 107324
Summary: Defaulted operator== with a dependent return type is
rejected
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: de34 at live dot cn
Target Milestone: ---
This code snippet is rejected by gcc even before instantiation (Godbolt link:
https://godbolt.org/z/zK6hWTabc).
template<class B>
struct Foo {
friend B operator==(Foo, Foo) = default;
};
I think Foo<bool> should compile according to [class.eq]/1, and sometimes the
validness of the `= default;` part should not be checked before instantiation.
On the other hand, defaulted operator<=> is correctly handled
(https://godbolt.org/z/Tffs4M4sj).