<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2987</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="2987"></A><H4>2987.
  
Remove dilapidated wording from <TT>static_cast</TT>
</H4>
<B>Section: </B>7.6.1.9&#160; [<A href="https://wg21.link/expr.static.cast">expr.static.cast</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD7
 &#160;&#160;&#160;

 <B>Submitter: </B>Brian Bi
 &#160;&#160;&#160;

 <B>Date: </B>2025-01-22<BR>


<P>[Accepted as a DR at the June, 2025 meeting.]</P>



<P>There is some ancient non-operational wording in
7.6.1.9 [<A href="https://wg21.link/expr.static.cast">expr.static.cast</A>].  It should be removed.</P>

<P><B>Proposed resolution (no objections during CWG reflector review starting 2025-03-04) (approved by CWG 2025-06-20):</B></P>

<OL>
<LI>
<P>Remove in 7.6.1.9 [<A href="https://wg21.link/expr.static.cast#1">expr.static.cast</A>] paragraph 1 as follows:</P>

<BLOCKQUOTE>

The result of the expression static_cast&lt;T&gt;(v) is the result of
converting the expression v to type T. If T is an lvalue reference
type or an rvalue reference to function type, the result is an lvalue;
if T is an rvalue reference to object type, the result is an xvalue;
otherwise, the result is a prvalue. <DEL>The static_cast operator shall not
cast away constness (7.6.1.11 [<A href="https://wg21.link/expr.const.cast">expr.const.cast</A>]).</DEL>

</BLOCKQUOTE>
</LI>

<LI>
<P>Remove 7.6.1.9 [<A href="https://wg21.link/expr.static.cast#6">expr.static.cast</A>] paragraph 6:</P>

<BLOCKQUOTE class="del">

Otherwise, the inverse of a standard conversion sequence
(7.3 [<A href="https://wg21.link/conv">conv</A>]) not containing an lvalue-to-rvalue
(7.3.2 [<A href="https://wg21.link/conv.lval">conv.lval</A>]), array-to-pointer
(7.3.3 [<A href="https://wg21.link/conv.array">conv.array</A>]), function-to-pointer
(7.3.4 [<A href="https://wg21.link/conv.func">conv.func</A>]), null pointer
(7.3.12 [<A href="https://wg21.link/conv.ptr">conv.ptr</A>]), null member pointer
(7.3.13 [<A href="https://wg21.link/conv.mem">conv.mem</A>]), boolean (7.3.15 [<A href="https://wg21.link/conv.bool">conv.bool</A>]),
or function pointer (7.3.14 [<A href="https://wg21.link/conv.fctptr">conv.fctptr</A>]) conversion, can be
performed explicitly using static_cast.  A program is ill-formed if it
uses static_cast to perform the inverse of an ill-formed standard
conversion sequence.  [<I>Example 2:</I>
<PRE>
  struct B { };
  struct D : private B { };
  void f() {
  static_cast&lt;D*&gt;((B*)0);
  static_cast&lt;int B::*&gt;((int D::*)0);
  }
</PRE>
&#8212;<I>end example</I>]
</BLOCKQUOTE>

</LI>
<LI>
<P>Change in 7.6.1.9 [<A href="https://wg21.link/expr.static.cast#7">expr.static.cast</A>] paragraph 7:</P>

<BLOCKQUOTE>

<DEL>The</DEL> <INS>Otherwise, the</INS> lvalue-to-rvalue
(7.3.2 [<A href="https://wg21.link/conv.lval">conv.lval</A>]), array-to-pointer
(7.3.3 [<A href="https://wg21.link/conv.array">conv.array</A>]), and function-to-pointer
(7.3.4 [<A href="https://wg21.link/conv.func">conv.func</A>]) conversions are applied to the
operand<INS>, and the conversions that can be performed
using <TT>static_cast</TT> are listed below</INS>. <INS>No other
conversion can be performed
using <TT>static_cast</TT>.</INS> <DEL>Such a static_cast is subject
to the restriction that the explicit conversion does not cast away
constness (7.6.1.11 [<A href="https://wg21.link/expr.const.cast">expr.const.cast</A>]), and the following
additional rules for specific cases:</DEL>

</BLOCKQUOTE>
</LI>

<LI>
<P>Remove 7.6.1.9 [<A href="https://wg21.link/expr.static.cast#14">expr.static.cast</A>] paragraph 14:</P>

<BLOCKQUOTE class="del">

No other conversion can be performed using static_cast.

</BLOCKQUOTE>
</LI>
</OL>
<BR><BR>
</BODY>
</HTML>
