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

2024-10-26


944. reinterpret_cast for all types with the same size and alignment

Section: 7.6.1.10  [expr.reinterpret.cast]     Status: NAD     Submitter: Miller     Date: 15 July, 2009

During the discussion of issue 799, which specified the result of using reinterpret_cast to convert an operand to its own type, it was observed that it is probably reasonable to allow reinterpret_cast between any two types that have the same size and alignment.

Additional note, April, 2015:

It has been suggested that this question may more properly be the province of EWG, especially in light of discussions during the resolution of issue 330.

Rationale (May, 2015):

CWG agreed that this question should be considered from a language design perspective and is thus being referred to EWG.

Rationale (June, 2021):

EWG resolved to close this issue. The bit_cast function addresses some of the use-cases. Supporting other use-cases would need a paper. See vote.