Is a temporary created as part of an argument to a function call guaranteed to stay around until the called function ends, even if the temporary isn\'t passed directly to th
The lifetime of your temp object A(4) will last long enough to call y()
The memory pointed to in the return of y() is not reliable, depending on threading and allocations it may be reallocated and the value changed before the call to foo() makes use of it.