<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3815: Freestanding enumerators specification is lacking</title>
<meta property="og:title" content="Issue 3815: Freestanding enumerators specification is lacking">
<meta property="og:description" content="C++ library issue. Status: Resolved">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3815.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#Resolved">Resolved</a> status.</em></p>
<h3 id="3815"><a href="lwg-defects.html#3815">3815</a>. Freestanding enumerators specification is lacking</h3>
<p><b>Section:</b> 16.3.3.7 <a href="https://wg21.link/freestanding.item">[freestanding.item]</a>, 32.5.2 <a href="https://wg21.link/atomics.syn">[atomics.syn]</a> <b>Status:</b> <a href="lwg-active.html#Resolved">Resolved</a>
 <b>Submitter:</b> Ben Craig <b>Opened:</b> 2022-11-06 <b>Last modified:</b> 2023-02-07</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all other</b> <a href="lwg-index.html#freestanding.item">issues</a> in [freestanding.item].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#Resolved">Resolved</a> status.</p>
<p><b>Discussion:</b></p>
<p>
This is a partial resolution of <b><a href="https://github.com/cplusplus/nbballot/issues/442">GB-130</a></b> 
(32.5.2 <a href="https://wg21.link/atomics.syn">[atomics.syn]</a> <code>memory_order_acquire</code> etc should be freestanding).
<p/>
It's not entirely clear whether the enumerators for the <code>std::memory_order</code> enum type are also freestanding, 
as those enumerators aren't shown in the synopsis, only in 32.5.4 <a href="https://wg21.link/atomics.order">[atomics.order]</a>.
</p>
<p><strong>Previous resolution [SUPERSEDED]:</strong></p>
<blockquote class="note">
<p>
This wording is relative to <a href="https://wg21.link/N4917" title=" Working Draft, Standard for Programming Language C++">N4917</a> <b>assuming that LWG <a href="lwg-defects.html#3753" title="Clarify entity vs. freestanding entity (Status: C++23)">3753</a><sup><a href="https://cplusplus.github.io/LWG/issue3753" title="Latest snapshot">(i)</a></sup> has been accepted 
(freestanding entity -&gt; freestanding item)</b>.
</p>

<blockquote class="note">
<p>
[<i>Drafting Note:</i> Four mutually exclusive options are prepared, depicted below by <b>Option A</b>, 
<b>Option B</b>, <b>Option C</b>, and <b>Option D</b>, respectively.] 
</p>
</blockquote>

<p>
<b>Option A:</b> Not a defect; no change required. Enumerators of freestanding enums are already part of 
freestanding with the current wording.  [freestanding.entity]#2 says the requirements of 
freestanding entities are the same as for hosted entities. The existence of the right enumerators (with the 
appropriate name scoping) are part of the requirements of the enum type.
</p>

<p>
<b>Option B:</b> Not a defect; provide a clarifying note. Same rationale as above, but we make this stance 
clear in  [freestanding.entity]#2.
</p>

<ol>
<li><p>Modify  [freestanding.entity] (Which has been renamed to [freestanding.item]) as indicated:</p>

<blockquote>
<p>
<b>16.3.3.6 Freestanding items [freestanding.item]</b>
<p/>
[&hellip;]
<p/>
-2- Unless otherwise specified, the requirements on freestanding items on a 
freestanding implementation are the same as the corresponding requirements in a hosted implementation.
<p/>
<ins>[<i>Note</i>: An <i>enumerator</i> places requirements on its enumeration. Freestanding item enumerations have 
the same <i>enumerator</i>s on freestanding implementations and hosted implementations. &mdash; <i>end note</i>]</ins>
<p/>
[&hellip;]
</p>
</blockquote>
</li>

</ol>

<p>
<b>Option C:</b> Add additional normative wording that makes enumerators freestanding if their enumeration types are 
freestanding.
</p>

<ol>
<li><p>Modify  [freestanding.entity] (Which has been renamed to [freestanding.item]) as indicated:</p>

<blockquote>
<p>
<b>16.3.3.6 Freestanding items [freestanding.item]</b>
<p/>
-1- A <i>freestanding item</i> is an entity or macro definition that is present in a freestanding implementation and a 
hosted implementation.
<p/>
<ins>-?- An <i>enumerator</i> of a freestanding item enumeration is a freestanding item.</ins>
<p/>
[&hellip;]
</p>
</blockquote>
</li>

</ol>

<p>
<b>Option D:</b> This is <b>Option C</b>, plus it handles class types as well. If enumerators aren't automatically 
included with the existing wording, then arguably, neither are class type members.
</p>

<ol>
<li><p>Modify  [freestanding.entity] (Which has been renamed to [freestanding.item]) as indicated:</p>

<blockquote>
<p>
<b>16.3.3.6 Freestanding items [freestanding.item]</b>
<p/>
-1- A <i>freestanding item</i> is an entity or macro definition that is present in a freestanding implementation and a 
hosted implementation.
<p/>
<ins>-?- An <i>enumerator</i> of a freestanding item enumeration is a freestanding item.</ins>
<p/>
<ins>-?- Members of freestanding item class types are freestanding items.</ins>
<p/>
[&hellip;]
</p>
</blockquote>
</li>

</ol>

</blockquote>

<p><i>[2022-11-08; Kona - move to open]</i></p>

<p>This will be resolved by the combined resolution in <a href="lwg-defects.html#3753" title="Clarify entity vs. freestanding entity (Status: C++23)">3753</a><sup><a href="https://cplusplus.github.io/LWG/issue3753" title="Latest snapshot">(i)</a></sup>.</p>

<p><i>[2022-11-22 Resolved by <a href="lwg-defects.html#3753" title="Clarify entity vs. freestanding entity (Status: C++23)">3753</a><sup><a href="https://cplusplus.github.io/LWG/issue3753" title="Latest snapshot">(i)</a></sup> accepted in Kona. Status changed: Open &rarr; Resolved.]</i></p>



<p id="res-3815"><b>Proposed resolution:</b></p>





</body>
</html>
