<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1268</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="1268"></A><H4>1268.
  
<TT>reinterpret_cast</TT> of an xvalue operand
</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>CD3
 &#160;&#160;&#160;

 <B>Submitter: </B>Michael Wong
 &#160;&#160;&#160;

 <B>Date: </B>2011-03-21<BR>


<P>[Moved to DR at the October, 2012 meeting.]</P>

<P>7.6.1.10 [<A href="https://wg21.link/expr.reinterpret.cast#11">expr.reinterpret.cast</A>] paragraph 11, dealing with casting to
reference types, only allows an lvalue operand.  Presumably it should
allow a glvalue operand when the target is an rvalue reference type.</P>

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

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

<BLOCKQUOTE>

<DEL>An lvalue</DEL> <INS>A glvalue</INS> expression of type
<TT>T1</TT> can be cast to the type &#8220;reference to
<TT>T2</TT>&#8221; if an expression of type &#8220;pointer to
<TT>T1</TT>&#8221; can be explicitly converted to the type
&#8220;pointer to <TT>T2</TT>&#8221; using a
<TT>reinterpret_cast</TT>. <INS>The result refers to the same object
as the source glvalue, but with the specified
type. [<I>Note:</I></INS> That is, <INS>for lvalues,</INS> a reference
cast <TT>reinterpret_cast&lt;T&amp;&gt;(x)</TT> has the same effect as
the conversion <TT>*reinterpret_cast&lt;T*&gt;(&amp;x)</TT> with the
built-in &amp; and * operators (and similarly for
<TT>reinterpret_cast&lt;T&amp;&amp;&gt;(x)</TT>). <INS>&#8212;<I>end
note</I>]</INS> <DEL>The result refers to the same object as the source
lvalue, but with a different type. The result is an lvalue for an
lvalue reference type or an rvalue reference to function type and an
xvalue for an rvalue reference to object type.</DEL> No temporary is
created,...

</BLOCKQUOTE>

<P><B>Additional note, January, 2012:</B></P>

<P>An objection has been raised
 to the proposed resolution on the
basis that it unnecessarily weakens the distinction between rvalues
and lvalues, making it easier to create dangling references.  Its
status has therefore been changed back to "review" to allow further
discussion.</P>

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