Closed
Description
Sibling issue of #104414.
According to https://eel.is/c++draft/class.compare#default-1, the following C++23 program should compile.
struct A {
bool operator ==(this A, A) = default;
};
int main() {
return A{}.operator ==(A{});
}
but Clang (18.1 and trunk) reports
<source>:2:20: error: defaulted member equality comparison operator must be const-qualified
2 | bool operator ==(this A, A) = default;
| ^
| const
<source>:2:8: error: invalid parameter type for defaulted equality comparison operator; found 'A', expected 'const A &'
2 | bool operator ==(this A, A) = default;
| ^ ~
2 errors generated.
FWIW, GCC accepts it.
Reproducible at https://godbolt.org/z/qM57nxz5d
See also https://stackoverflow.com/a/78808748/24103368 from @brevzin.