https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98841
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
/* Returning '*this' is obviously OK. */
if (retval == current_class_ref)
warn = false;
assumes that retval and current_class_ref must be equal, but that isn't clearly
the case, they can be different pointers.
The retval is created in templates here in:
#6 0x0000000000e0a273 in build_min (code=INDIRECT_REF, tt=<record_type
0x7fffea1b4000 Foo>) at ../../gcc/cp/tree.c:3455
#7 0x0000000000e3548c in build_x_indirect_ref (loc=251460, expr=<nop_expr
0x7fffea19ea00>, errorstring=RO_UNARY_STAR, complain=3) at
../../gcc/cp/typeck.c:3329
So, I wonder if we shouldn't do:
if (retval == current_class_ref
|| operand_equal_p (retval, current_class_ref, 0))
warn = false;
instead.