[Bug c++/60517] warning/error for taking address of member of a temporary object

lopezibanez at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jul 25 17:49:00 GMT 2017


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

--- Comment #24 from Manuel López-Ibáñez <lopezibanez at gmail dot com> ---
How does typeck.c check that it is a temporary? The important thing is not
that it is an ARRAY_REF but that it is a member of a temporary object. Not
sure how to check that.

Marc points above that the FE introduces a clobber to mark the death of the
temporary, so it knows.

The problem of warning for artificials is that optimization passes create
and read uninitialized memory if this provides an advantage and it doesn't
change the behaviour of the code. Warning about those would be very
annoying, if the user code is correct.


More information about the Gcc-bugs mailing list