[Bug c++/97197] With -O2, Incorrect -Werror=maybe-uninitialized thrown, leads to 'target_mem_ref' and 'dump_expr<expression error>' in message
davidfink314 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Sep 25 14:50:30 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97197
--- Comment #4 from David Fink <davidfink314 at gmail dot com> ---
Hi Jakub,
I tried to reduce the code as much as possible before reporting, which is why
the example has the "this != &o" check in the copy constructor.
The original code where I saw this problem had the "this != &o" check in the
assignment operator, and the copy constructor called the assignment operator.
In the reported version, I manually inlined the assignment operator.
I think the original code is also silly, but not as clearly wrong as the
pointer check in the copy constructor.
Note that the warning happens on a completely different class "Normal" from the
silly code "Weirdo", so I'd consider that a bug in addition to the diagnostic
containing 'target_mem_ref' and 'dump_expr<expression error>'.
More information about the Gcc-bugs
mailing list