<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 137</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="137"></A><H4>137.
  
<TT>static_cast</TT> of <I>cv</I> <TT>void*</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>TC1
 &#160;&#160;&#160;

 <B>Submitter: </B>Mike Miller
 &#160;&#160;&#160;

 <B>Date: </B>13 July 1999<BR>





<P>According to 7.6.1.9 [<A href="https://wg21.link/expr.static.cast">expr.static.cast</A>]

paragraph 10,</P>

<BLOCKQUOTE>
An rvalue of type "pointer to <I>cv</I> <TT>void</TT>" can be explicitly
converted to a pointer to object type.
</BLOCKQUOTE>

No requirements are stated regarding the cv-qualification of the
pointer to object type.  Contrast this with the formula used in
paragraphs 5, 8, and 9, where the treatment of cv-qualification
is explicit, requiring that the target type be at least as
cv-qualified as the source.

There is an apparently general requirement on all forms of
<TT>static_cast</TT> in
7.6.1.9 [<A href="https://wg21.link/expr.static.cast#1">expr.static.cast</A>] paragraph 1
that it
"shall not cast away constness."
Assuming that this restriction applies to paragraph 10, since there is
no explicit exception to the general rule, that still leaves
open the question of whether one can "cast away volatility"
in a conversion from <TT>volatile void*</TT> to a pointer to object
type.

Should 7.6.1.9 [<A href="https://wg21.link/expr.static.cast#10">expr.static.cast</A>] paragraph 10

be rewritten to handle cv-qualification in
the same way as paragraphs 5, 8, and 9?

<P><B>Proposed resolution (10/00):</B></P>

<P>Change the first sentence of
7.6.1.9 [<A href="https://wg21.link/expr.static.cast#10">expr.static.cast</A>] paragraph 10
to</P>
<BLOCKQUOTE>
An rvalue of type "pointer to <I>cv1</I> <TT>void</TT>" can be
converted to an rvalue of type "pointer to <I>cv2</I> <TT>T</TT>", where
<TT>T</TT> is an object type and <I>cv2</I> is the same cv-qualification
as, or greater cv-qualification than, <I>cv1</I>.
</BLOCKQUOTE>
<BR><BR>
</BODY>
</HTML>
