<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1120</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="1120"></A><H4>1120.
  
<TT>reinterpret_cast</TT> and <TT>void*</TT>
</H4>
<B>Section: </B>7.6.1.10&#160; [<A href="https://wg21.link/expr.reinterpret.cast">expr.reinterpret.cast</A>]
 &#160;&#160;&#160;

 <B>Status: </B>C++11
 &#160;&#160;&#160;

 <B>Submitter: </B>GB
 &#160;&#160;&#160;

 <B>Date: </B>2010-08-02<BR><BR>


<P>[Voted into the WP at the March, 2011 meeting.]</P>

<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3296.html#GB22">N3092 comment
  GB&#160;22<BR></A>

<P>It is not permitted to use <TT>reinterpret_cast</TT> to convert
between pointers to object type and pointers to <TT>void</TT>.</P>

<P>See also <A HREF="573.html">issue 573</A>.</P>

<P><B>Proposed resolution (August, 2010):</B></P>

<P>Change 7.6.1.10 [<A href="https://wg21.link/expr.reinterpret.cast#7">expr.reinterpret.cast</A>] paragraph 7 as follows:</P>

<BLOCKQUOTE>

<DEL>A pointer to an object</DEL> <INS>An object
pointer</INS> can be explicitly converted to <DEL>a pointer
to a different object type</DEL> <INS>an object pointer of a
different type</INS>.<SUP>70</SUP> When a prvalue <TT>v</TT>
of type &#8220;pointer to <TT>T1</TT>&#8221; is converted to
the type &#8220;pointer to
<I>cv</I> <TT>T2</TT>&#8221;, the result is
<TT>static_cast&lt;</TT><I>cv</I>
<TT>T2*&gt;(static_cast&lt;</TT><I>cv</I>
<TT>void*&gt;(v))</TT> if both <TT>T1</TT> and <TT>T2</TT>
are standard-layout types (6.9 [<A href="https://wg21.link/basic.types">basic.types</A>]) and the
alignment requirements of <TT>T2</TT> are no stricter than
those of <TT>T1</TT><INS>, or if either type is
<TT>void</TT></INS>.  Converting a prvalue of type
&#8220;pointer to <TT>T1</TT>&#8221; to the type
&#8220;pointer to <TT>T2</TT>&#8221; (where <TT>T1</TT> and
<TT>T2</TT> are object types and where the alignment
requirements of <TT>T2</TT> are no stricter than those of
<TT>T1</TT>) and back to its original type yields the
original pointer value.  The result of any other such
pointer conversion is unspecified.

</BLOCKQUOTE>

<P>(Note: this resolution depends on that of <A HREF="573.html">issue 573</A>.)</P>

<BR><BR>
</BODY>
</HTML>
