<html>
<head>
<meta charset="UTF-8">
<title>P2617R0: Responses to NB comments on DTS 12907 "Extensions to C++ for
Transactional Memory Version 2"</title>

<style type="text/css">
  ins { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .new { text-decoration:none; background-color:#D0FFD0 }
  del { text-decoration:line-through; background-color:#FFA0A0 }  
  strong { font-weight: inherit; color: #2020ff }
  table, td, th { border: 1px solid black; border-collapse:collapse; padding: 5px }
</style>
</head>

<body>
ISO/IEC JTC1 SC22 WG21 P2617R0<br/>
Author: Jens Maurer<br/>
Target audience: SG5, CWG, LWG<br/>
2022-07-15<br/>

<h1>P2617R0: Responses to NB comments on DTS 12907 "Extensions to C++ for
Transactional Memory Version 2"</h1>

<h2>Introduction</h2>

<p>
SC22 N5721 contains the six collated NB comments resulting from the
DTS ballot on C++ Extensions for Minimal Transactional Memory.  This
paper presents the proposed responses to the NB comments, presented as
changes against WG21 N4906 "Working Draft, Extensions to C++ for
Transactional Memory Version 2", the base document for the DTS ballot.
</p>

<h2>Wording changes</h2>

<h3>CA-001: Transferring control into an atomic block</h3>

<p><b>Disposition:</b> Accept.</p>

<p>Change in subclause 8.8 [stmt.tx] paragraph 3:</p>

<blockquote>
<del>A goto or switch statement shall not be used to transfer control
into an atomic block.</del>
<ins>
A <code>case</code> or <code>default</code> label appearing within an
atomic block shall be associated with a <code>switch</code> statement
(8.5.3 [stmt.switch]) within the same atomic block. A label (8.2
[stmt.label]) declared in an atomic block shall only be referred to by
a statement in the same atomic block.</ins>
</blockquote>

<h3>CA-002: Exiting an atomic block via return or goto</h3>

<p><b>Disposition:</b> Accept with modifications.</p>

<p><strong>Change in 8.8 [stmt.tx] paragraph 2:</strong></p>

<blockquote>
The start of the atomic block is immediately <del>before</del> <ins>after</ins> the opening <code>{</code> of the <em>compound-statement</em>.
<del>The</del> </del><ins>Evaluation of the</ins> end of the atomic
block <del>is immediately after the closing <code>}</code> of
the <em>compound-statement</em></del>
<ins>occurs when the invocation of the destructor for a hypothetical
automatic variable of class type declared at the start of the atomic
block would happen (8.7.1 [stmt.jump.general])</ins>.
</blockquote>

<h3>CA-003: Cross-reference to manifest-constant evaluated</h3>

<p><b>Disposition:</b> Accept.</p>

<p>Change in 8.8 [stmt.tx] paragraph 6:</p>

<blockquote>
If the execution of an atomic block evaluates any of the following
outside of a manifestly constant-evaluated context (<ins>7.7
[expr.const]</ins>), the behavior is implementation-defined: ...
</blockquote>

<h3>CA-004: Implementation-defined behavior for library functions</h3>

<p><b>Disposition:</b> Accept.</p>

<p>Change in 8.8 [stmt.tx] paragraph 6:</p>

<blockquote>
<ul>
<li>...</li>
<li>
an invocation of a function <del>other than one of the standard library
functions specified in 16.4.6.17, unless the function is inline with a
reachable definition;</del>
<ins>, unless</ins>
<ul>
<li><ins>the function is inline with a reachable definition or</ins></li>
<li><ins>the function is a library function that may be used in an atomic block (16.4.6.17);</ins></li>
</ul>
</li>
<li>...</li>
</ul>
</blockquote>

<h3>CA-005: Setting the global locale in an atomic block</h3>

<p><b>Disposition:</b> Accept.</p>

<p>Add a new bullet in 16.4.6.17 [atomic.use]:</p>

<blockquote>
<ul>
<li>...</li>
<li><code>locale</code> construction (28.3.1.3)</li>
<li><ins><code>locale::global</code> (28.3.1.6 [locale.statics])</ins></li>
<li>...</li>
</ul>
</blockquote>

<h3>CA-006: Scope</h3>

<p><b>Disposition:</b> Accept.</p>

<p>Change in Clause 1 [scope] paragraph 1:</p>

<blockquote>
This document describes requirements for implementations of an
interface that computer programs written in the C++ programming
language <del>may</del> <ins>can</ins> use to <del>invoke algorithms with concurrent execution. The
algorithms described by this document are realizable across a broad
class of computer architectures.</del>
<ins>express groups of operations (known as
transactions) that appear to execute atomically in relation to other
transactions (concurrent or otherwise).</ins>
</blockquote>

<h3>Additional change: Initialization of variables with thread storage duration</h3>

<p>Change in 8.8 [stmt.tx] paragraph 6:</p>

<ul>
<li>...</li>
<li>dynamic initialization of a variable with thread storage duration.
<ins>[ Note: That includes the case when such an initialization is
evaluated within an atomic block because the initialization was
deferred (6.9.3.3 [basic.start.dynamic]). -- end note ] </ins>
</ul>

</body>
</html>
