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


2225. reinterpret_cast to same floating-point type

Section: 7.6.1.10  [expr.reinterpret.cast]     Status: NAD     Submitter: Aaron Ballman     Date: 2016-01-14

Consider this inconsistency:

  void func(long l, float f) {
   (void)reinterpret_cast<long *>(&l); // ok
   (void)reinterpret_cast<long>(l); // ok
   (void)reinterpret_cast<float *>(&f); // ok
   (void)reinterpret_cast<float>(f); // ill-formed
  }

Suggested resolution:

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

... An expression of integralarithmetic, enumeration, pointer, or pointer-to-member type can be explicitly converted to its own type; such a cast yields the value of its operand.

Rationale (November, 2016):

The specification is as intended.