Title
reinterpret_cast and void*
Status
c++11
Section
7.6.1.10 [expr.reinterpret.cast]
Submitter
GB

Created on 2010-08-02.00:00:00 last changed 131 months ago

Messages

Date: 2011-03-15.00:00:00

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

Date: 2010-08-15.00:00:00

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.)

Date: 2010-08-02.00:00:00
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.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3312
2011-04-10 00:00:00adminsetstatus: ready -> fdis
2010-11-29 00:00:00adminsetstatus: review -> ready
2010-08-23 00:00:00adminsetmessages: + msg2827
2010-08-02 00:00:00admincreate