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

2024-11-11


1011. Standard conversions that cannot be inverted

Section: 7.6.1.9  [expr.static.cast]     Status: C++11     Submitter: John Spicer     Date: 2009-12-03

[Voted into the WP at the November, 2010 meeting.]

According to 7.6.1.9 [expr.static.cast] paragraph 7, static_cast can be used to perform the inverse of any standard conversion sequence except the lvalue-to-rvalue, array-to-pointer, function-to-pointer, and boolean conversions. The null pointer and null pointer-to-member conversions should also be listed — it should not be permitted to cast a pointer or pointer-to-member to either integral type or std::nullptr_t.

Proposed resolution (October, 2010):

  1. Change 7.3.12 [conv.ptr] paragraph 1 as follows:

  2. ...A null pointer constant can be converted to a pointer type; the result is the null pointer value of that type and is distinguishable from every other value of pointer to object or pointer to function type. Such a conversion is called a null pointer conversion. Two null pointer values...
  3. Change 7.3.13 [conv.mem] paragraph 1 as follows:

  4. A null pointer constant (7.3.12 [conv.ptr]) can be converted to a pointer to member type; the result is the null member pointer value of that type and is distinguishable from any pointer to member not created from a null pointer constant. Such a conversion is called a null member pointer conversion. Two null member pointer values...
  5. Change 7.6.1.9 [expr.static.cast] paragraph 7 as follows:

  6. The inverse of any standard conversion sequence (7.3 [conv]), other than the not containing an lvalue-to-rvalue (7.3.2 [conv.lval]), array-to-pointer (7.3.3 [conv.array]), function-to-pointer (7.3.4 [conv.func]), and null pointer (7.3.12 [conv.ptr]), null member pointer (7.3.13 [conv.mem]), or boolean (7.3.14 [conv.fctptr]) conversions, can be performed explicitly using static_cast. A program is ill-formed...