This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


1120. reinterpret_cast and void*

Section: 7.6.1.10  [expr.reinterpret.cast]     Status: C++11     Submitter: GB     Date: 2010-08-02

[Voted into the WP at the March, 2011 meeting.]

N3092 comment GB 22

It is not permitted to use reinterpret_cast to convert between pointers to object type and pointers to void.

See also issue 573.

Proposed resolution (August, 2010):

Change 7.6.1.10 [expr.reinterpret.cast] paragraph 7 as follows:

A pointer to an object An object pointer can be explicitly converted to a pointer to a different object type an object pointer of a different type.70 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 (6.8 [basic.types]) and the alignment requirements of T2 are no stricter than those of T1, or if either type is void. Converting a prvalue of type “pointer to T1” to the type “pointer to T2” (where T1 and T2 are object types and where the alignment requirements of T2 are no stricter than those of T1) and back to its original type yields the original pointer value. The result of any other such pointer conversion is unspecified.

(Note: this resolution depends on that of issue 573.)