[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type
antoshkka at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu May 10 17:03:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899
--- Comment #11 from Antony Polukhin <antoshkka at gmail dot com> ---
Seems perfect https://godbolt.org/g/GX3GQd
The mov is not generated for any constructor and the following code:
extern struct A a;
struct A {
int m, n;
A(const A &v);
};
A::A(const A &v) : m(v.m), n((a.m = 1, v.m)) {}
Is not optimized to "A::A(int, const A &v) : m(v.m), n(v.m) { a.m = 1; }"
(which is a mistake).
Are there some tests to make sure that the `mov` won't appear again?
More information about the Gcc-bugs
mailing list