This is the mail archive of the
mailing list for the GCC project.
Re: Meaning of TREE_ADDRESSABLE types (Was: [PATCH] Fix PR40389)
On 06/16/2009 05:38 AM, Jakub Jelinek wrote:
On Tue, Jun 16, 2009 at 11:21:18AM +0200, Richard Guenther wrote:
Ok, this sort-of was my understanding as well. But I do not see
how this is connected to the NRV issue at all - certainly if NRV
is applied the caller can take the address of the return slot if
the language standard says that is a valid thing to do.
That would be taking the address of a local variable (in the called
function), which is valid, but once the function returns doing anything
with that address is undefined even though due to NRV the object really
lives in the caller's frame. So it's not a problem for
The issue with TREE_ADDRESSABLE types is that you can have code in the
constructors/destructors to keep track of all objects of that type (as
in the PR): in that case you aren't using the address of a local
variable, you're remembering the 'this' pointer passed to the constructor.