struct S {
int i;
bool operator==(this const S, const S&) = default;
};
Notice the explicit object parameter is this const S, not this const S&. So it should be rejected; but instead, Clang quietly accepts. Fortunately, it gives the "correct" mangled name and codegen for the by-value argument, so this is more like an accidental language extension rather than a miscompile.
https://godbolt.org/z/bKjP8e3nh
Notice the explicit object parameter is
this const S
, notthis const S&
. So it should be rejected; but instead, Clang quietly accepts. Fortunately, it gives the "correct" mangled name and codegen for the by-value argument, so this is more like an accidental language extension rather than a miscompile.