When you take the address of the rvalue link, it returns a pointer to the object to which the link is bound, for example, with lvalue links. The object can be temporary or not (if, for example, you set the value of lvalue to rvalue, as in the code).
int y = 5; foo(static_cast<int&&>(y)); does not create temporary. This conversion is described in part 5.2.9/3 standard:
The value of a glvalue, a prvalue class, or a prvalue array of type " cv1 T1 " can be distinguished to enter "rvalue reference to cv2 T2 " if " cv2 T2 " refers to " cv1 T1 ".
A temporary creation will be created if, for example, you call foo(1); .
Anton Savin
source share