Created on 2011-11-01.00:00:00 last changed 90 months ago
[Moved to DR at the April, 2013 meeting.]
Proposed resolution (February, 2012):
Change 7.3.12 [conv.ptr] paragraph 2 as follows:
A prvalue of type “pointer to cv T,” where T is an object type, can be converted to a prvalue of type “pointer to cv void”. The result of converting a
“pointer to cv T”to a “pointer to cv void” points to the start of the storage location where the object of type T resides, as if the object is a most derived object (6.7.2 [intro.object]) of type T (that is, not a base class subobject). The null pointer value is converted to the null pointer value of the destination type.
Change 220.127.116.11 [expr.static.cast] paragraph 13 as follows:
A prvalue of type “pointer to cv1 void” can be converted to a prvalue of type “pointer to cv2 T,” where T is an object type and cv2 is the same cv-qualification as, or greater cv-qualification than, cv1. The null pointer value is converted to the null pointer value of the destination type. A value of type pointer to object converted to “pointer to cv void” and back, possibly with different cv-qualification, shall have its original value...
Change 18.104.22.168 [expr.reinterpret.cast] paragraph 7 as follows:
An object pointer can be explicitly converted to 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 T 2”, the result is static_cast<cv T 2*>(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.
The definedness of various pointer conversions (see 22.214.171.124 [expr.reinterpret.cast] paragraph 7, 11.4 [class.mem] paragraph 20, 126.96.36.199 [expr.static.cast] paragraph 13) relies on the properties of the types involved, such as whether they are standard-layout types and their intrinsic alignment. This creates contradictions and unnecessary unspecified behavior when the actual values of the pointer involved would actually permit the operations. Recasting the specification in terms of the memory model instead of the types of the objects provides a more coherent specification.
|2014-03-03 00:00:00||admin||set||status: drwp -> cd3|
|2013-10-14 00:00:00||admin||set||status: dr -> drwp|
|2013-05-03 00:00:00||admin||set||messages: + msg4384|
|2013-05-03 00:00:00||admin||set||status: ready -> dr|
|2012-11-03 00:00:00||admin||set||status: review -> ready|
|2012-02-27 00:00:00||admin||set||messages: + msg3752|
|2012-02-27 00:00:00||admin||set||status: open -> review|