https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103067

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is "correct" in that each function is compiled in isolation, and within
the body of the function you are comparing two different objects, this->a and
rhs.a

The fact that rhs and *this actually alias each other **in your specific
example** is not visible when compiling that function (and is not always going
to be true for other alls to the function).

You'll get just the same for something like:

bool f(int& i, int& j) { return i == j; }
int i = 0;
bool b = f(i, i);

Reply via email to