https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97197
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The this != &o check makes no sense, invoking a copy constructor on itself is just wrong and if the compiler isn't able to optimize that bogus check early enough, that is the reason why you get the warning. Just don't do that. The compiler bug is the lack of TARGET_MEM_REF support in the diagnostic of course.