<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2654</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="2654"></A><H4>2654.
  
Un-deprecation of compound volatile assignments
</H4>
<B>Section: </B>7.6.19&#160; [<A href="https://wg21.link/expr.assign">expr.assign</A>]
 &#160;&#160;&#160;

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

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

 <B>Date: </B>2022-11-03
  &#160;&#160;&#160;
  <B>Liaison: </B>EWG<BR><BR>


<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2720r0.pdf#US16-045">P2720R0 comment
  US&#160;16-045<BR></A>

<P>[Accepted as a DR at the November, 2022 meeting.]</P>

<P>
Many functions of volatile were deprecated in C++20. In C++23,
volatile compound operations were de-deprecated by P2327. The
rationale for this de-deprecation is lacking.</P>

<P>
Deprecation is not removal. P2327 in C++23 is stopping the change that
we began with C++20, mere moments ago if counting by adoption time. It
primarily argued that it's an inconvenient change, and that some of
the audience would just not cooperate with WG21's indicated direction,
so WG21 should compromise the technical consistency of the Standard so
they could continue to not cooperate.
</P>

<P>
The paper did not bring new information on the technical merits of the
case, and net the result of applying it was a technically dissonant
Standard specification --- a strictly worse specification than
C++20. Bitwise compound operations are not special for any technical
reason, they are only special because making them special shields some
from deprecation diagnostics.
</P>

<P><B>EWG 2022-11-07</B></P>

<P>Contrary to the direction desired in the NB comment, EWG resolved
to un-deprecate all volatile compound assignments.</P>

<P><B>Proposed resolution (approved by CWG 2022-11-08):</B></P>

<P>Change in 7.6.19 [<A href="https://wg21.link/expr.assign#6">expr.assign</A>] paragraph 6 as follows:</P>

<BLOCKQUOTE>

The behavior of an expression of the form E1 op= E2 is equivalent to
E1 = E1 op E2 except that E1 is evaluated only once.
<INS>[ Note: The object designated by E1 is accessed twice. -- end note ]</INS>
<DEL>Such expressions
are deprecated if E1 has volatile-qualified type and op is not one of
the bitwise operators |, &amp;, ^; see D.5.</DEL>

</BLOCKQUOTE>

<P>Change in D.4 [<A href="https://wg21.link/depr.volatile.type#2">depr.volatile.type</A>] paragraph 2 as follows:</P>

<PRE>
  brachiosaur += neck;                //<SPAN CLASS="cmnt"> <DEL>deprecated</DEL><INS>OK</INS></SPAN>
  <DEL>brachiosaur = brachiosaur + neck;   //<SPAN CLASS="cmnt"> OK</SPAN></DEL>
  <DEL>brachiosaur |= neck;                //<SPAN CLASS="cmnt"> OK, bitwise compound expression</SPAN></DEL>
</PRE>

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