In C++ draft standard N3337 section 5.2.10 Reinterpret cast
clause 7 (emphasis mine):
An object pointer can be explicitly converted to an object pointer to a different type. When a prvalue v of type “pointer to T1” is converted to the type “pointer to cv T2”, the result is
static_cast<cv T2*>(static_cast<cv void*>(v))
if both T1 and T2 are standard-layout types (3.9) and the alignment requirements of T2 are no stricter than those of T1, or if either type is void.
Does this mean that the expression v
is a prvalue?. If so, then
int a = 0x1234;
int *pa = &a;
char *pc = reinterpret_cast<char *>(pa);
Above,the variable pa
is an lvalue
, so can we think if a variable of lvalue
is in the right expression, the variable is a prvalue
of type?.
The specification uses v
to represent an expression. It is not necessarily a name of a variable.
In your example, the paragraph you referred to does not apply directly because pa
is an lvalue. Instead, the lvalue-to-rvalue conversion is applied firstly, then this paragraph applies.