<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3753: Clarify entity vs. freestanding entity</title>
<meta property="og:title" content="Issue 3753: Clarify entity vs. freestanding entity">
<meta property="og:description" content="C++ library issue. Status: C++23">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3753.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#C++23">C++23</a> status.</em></p>
<h3 id="3753"><a href="lwg-defects.html#3753">3753</a>. Clarify entity vs. freestanding entity</h3>
<p><b>Section:</b> 16.3.3.7 <a href="https://wg21.link/freestanding.item">[freestanding.item]</a> <b>Status:</b> <a href="lwg-active.html#C++23">C++23</a>
 <b>Submitter:</b> Ben Craig <b>Opened:</b> 2022-08-23 <b>Last modified:</b> 2023-11-22</p>
<p><b>Priority: </b>2
</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#C++23">C++23</a> status.</p>
<p><b>Discussion:</b></p>
<p>
This addresses NB comment
<b><a href="https://github.com/cplusplus/nbballot/issues/448">GB-075</a></b>
( [freeestanding.entity] "Freestanding entities" are not entities)
</p>

<p>
 [freestanding.entity] p1 defines a freestanding entity as
a declaration or macro definition.
</p>

<p>
 [freestanding.entity] p3 then says
"entities followed with a comment [&hellip;] are freestanding entities".
</p>

<p>
This is inconsistent, and breaks with macros,
because macros are not entities, but they can be freestanding entities.
</p>

<p><i>[2022-09-23; Reflector poll]</i></p>

<p>
Set priority to 2 after reflector poll.
</p>
<p>
It's confusing for "freestanding entities" to be two things, neither of which are entities. Declarations may declare entities, they are not entities themselves. Given this definition, p6/7/8 makes no sense. A namespace can't be a freestanding entity since it's neither a declaration nor a macro definition.
</p>
<p>
"freestanding entities" is not best name, given the collision with core entity, but I think that this is separable issue.
</p>


<p><i>[2022-09-28; Reflector poll]</i></p>

<p>
Set status to Tentatively Ready after five votes in favour during reflector poll.
</p>

<p><strong>Previous resolution [SUPERSEDED]:</strong></p>
<blockquote class="note">
<p> This wording is relative to the forthcoming C++23 CD. </p>

<ul>
<li>
<p>
Modify  [freestanding.entity] as indicated:
</p>

<blockquote>
-3- In a header synopsis,
<del>entities</del>
<ins>declarations and macro definitions</ins>
followed with a comment that includes <i>freestanding</i>
are freestanding entities.
</blockquote>
</li>
</ul>
</blockquote>

<p><i>[2022-11-06; Ben Craig provides new wording]</i></p>


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

<p>New proposed resolution to be added.  </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>.
</p>

<ol>
<li><p>Modify  [freestanding.entity] as indicated:</p>

<blockquote class="note">
<p>
[<i>Drafting note:</i> Replace the section name [freestanding.entity] by [freestanding.item] throughout the working draft]
</p>
</blockquote>

<blockquote>
<p>
<b>16.3.3.6 Freestanding <del>entities</del><ins>items</ins> [freestanding.<ins>item</ins><del>entity</del>]</b>
<p/>
-1- A <i>freestanding <del>entity</del><ins>item</ins></i> is <del>a declaration</del><ins>an entity</ins> or 
macro definition that is present in a freestanding implementation and a hosted implementation.
<p/>
-2- Unless otherwise specified, the requirements on freestanding <del>entities</del><ins>items</ins> on a 
freestanding implementation are the same as the corresponding requirements in a hosted implementation.
<p/>
-3- In a header synopsis, entities <ins>introduced by declarations</ins> followed with a comment that includes 
<i>freestanding</i> are freestanding <del>entities</del><ins>items</ins>.
<p/>
<ins>-?- In a header synopsis, macro definitions followed with a comment that includes <i>freestanding</i> are 
freestanding items.</ins>
<p/>
[&hellip;]
<p/>
-4- If a header synopsis begins with a comment that includes <i>all freestanding</i>, then all of the 
<ins>entities introduced by</ins> declarations <del>and macro definitions</del> in the header synopsis are 
freestanding <del>entities</del><ins>items</ins>.
<p/>
<ins>-?- If a header synopsis begins with a comment that includes <i>all freestanding</i>, then all of the 
macro definitions in the header synopsis are freestanding items.</ins>
<p/>
[&hellip;]
<p/>
-5- Deduction guides for freestanding <del>entity</del><ins>item</ins> class templates are freestanding 
<del>entities</del><ins>items</ins>.
<p/>
-6- Enclosing namespaces of freestanding  <del>entities</del><ins>items</ins> are freestanding <del>entities</del><ins>items</ins>.
<p/>
-7- Friends of freestanding <del>entities</del><ins>items</ins> are freestanding <del>entities</del><ins>items</ins>.
<p/>
-8- Entities denoted by freestanding  <del>entity</del><ins>item</ins> <i>typedef-name</i>s and freestanding 
 <del>entity</del><ins>item</ins> alias templates are freestanding <del>entities</del><ins>items</ins>.
</p>
</blockquote>
</li>

<li><p>Modify 16.4.2.5 <a href="https://wg21.link/compliance">[compliance]</a> as indicated:</p>

<blockquote>
<p>
-3- For each of the headers listed in Table 28, a freestanding implementation provides at least the freestanding
<del>entities</del><ins>items</ins> ( [freestanding.entity]) declared in the header.
</p>
</blockquote>
</li>

<li><p>Modify 22.10.15.5 <a href="https://wg21.link/func.bind.place">[func.bind.place]</a> as indicated:</p>

<blockquote>
<p>
-3- Placeholders are freestanding <del>entities</del><ins>items</ins> ( [freestanding.entity]).
</p>
</blockquote>
</li>
</ol>

</blockquote>

<p><i>[2022-11-08; Ben Craig provides improved wording]</i></p>

<p>This combined resolution addresses both 3753 and LWG <a href="lwg-defects.html#3815" title="Freestanding enumerators specification is lacking (Status: Resolved)">3815</a><sup><a href="https://cplusplus.github.io/LWG/issue3815" title="Latest snapshot">(i)</a></sup>,
and has already been reviewed by LWG.</p>

<p>
This resolves ballot comment GB-75.
It also partially addresses GB-130 (along with LWG <a href="lwg-defects.html#3814" title="Add freestanding items requested by NB comments (Status: C++23)">3814</a><sup><a href="https://cplusplus.github.io/LWG/issue3814" title="Latest snapshot">(i)</a></sup>).
</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>.
</p>

<ol>
<li><p>Modify 16.3.3.6 <a href="https://wg21.link/freestanding.entity">[freestanding.entity]</a> as indicated:</p>

<blockquote class="note">
<p>
[<i>Drafting note:</i> Replace the section name [freestanding.entity] by [freestanding.item] throughout the working draft]
</p>
</blockquote>

<blockquote>
<p>
<b>16.3.3.6 Freestanding <del>entities</del><ins>items</ins> [freestanding.<ins>item</ins><del>entity</del>]</b>
<p/>
-1- A <i>freestanding <del>entity</del><ins>item</ins></i> is <del>a declaration</del><ins>an entity</ins> or
macro definition that is present in a freestanding implementation and a hosted implementation.
<p/>
-2- Unless otherwise specified, the requirements on <ins>non-namespace </ins>freestanding <del>entities</del><ins>items</ins> on a freestanding implementation are the same as the corresponding requirements in a hosted implementation.
<p/>
<ins>[<i>Note</i>: Enumerators impose requirements on their enumerations. Freestanding item enumerations have the same enumerators on freestanding implementations and hosted implementations. Members and deduction guides impose requirements on their class types. Class types have the same deduction guides and members on freestanding implementations and hosted implementations. — <i>end note</i>]</ins>
<p/>
-3- In a header synopsis, <del>entities </del><ins>each entity introduced by a declaration</ins> followed <del>with</del><ins>by</ins> a comment that includes
<i>freestanding</i> <del>are</del><ins>is a</ins> freestanding <del>entities</del><ins>item</ins>.
<p/>
<ins>-?- In a header synopsis, each macro definition followed by a comment that includes <i>freestanding</i> is a
freestanding item.</ins>
<p/>
[&hellip;]
<p/>
-4- If a header synopsis begins with a comment that includes <i>all freestanding</i>, then <del>all of the
 declarations and macro definitions</del><ins>each entity introduced by a declaration</ins> in the header synopsis <del>are</del><ins>is a</ins>
freestanding <del>entities</del><ins>item</ins>.
<p/>
<ins>-?- If a header synopsis begins with a comment that includes <i>all freestanding</i>, then each
macro definition in the header synopsis is a freestanding item.</ins>
<p/>
[&hellip;]
<p/>
<del>-5- Deduction guides for freestanding entity class templates are freestanding
entities.</del>
<p/>
-6- <del>Enclosing namespaces of freestanding entities are freestanding entities.</del>
<ins>Each enclosing namespace of each freestanding item is a freestanding item.</ins>
<p/>
-7- <del>Friends of freestanding entities are freestanding entities.</del>
<ins>Each friend of each freestanding item is a freestanding item.</ins>
<p/>
-8- <del>Entities denoted by freestanding entity <i>typedef-name</i>s and freestanding entity alias templates are freestanding entities.</del>
<ins>Each entity denoted by each freestanding item <i>typedef-name</i> and each freestanding item alias template is a freestanding item.</ins>
</p>
</blockquote>
</li>

<li><p>Modify 16.4.2.5 <a href="https://wg21.link/compliance">[compliance]</a> as indicated:</p>

<blockquote>
<p>
-3- For each of the headers listed in Table 28, a freestanding implementation provides at least the freestanding
<del>entities</del><ins>items</ins> (16.3.3.6 <a href="https://wg21.link/freestanding.entity">[freestanding.<del>entity</del><ins>item</ins>]</a>) declared in the header.
</p>
</blockquote>
</li>

<li><p>Modify 22.10.15.5 <a href="https://wg21.link/func.bind.place">[func.bind.place]</a> as indicated:</p>

<blockquote>
<p>
-3- Placeholders are freestanding <del>entities</del><ins>items</ins> (16.3.3.6 <a href="https://wg21.link/freestanding.entity">[freestanding.<del>entity</del><ins>item</ins>]</a>).
</p>
</blockquote>
</li>
</ol>

</blockquote>

<p><i>[2022-11-09; Ben Craig and Tomasz provide improved wording]</i></p>

<p>
This new resolution merges definition of freestanding item for entity in macro into bullet lists.
It still addresses both 3753 and LWG <a href="lwg-defects.html#3815" title="Freestanding enumerators specification is lacking (Status: Resolved)">3815</a><sup><a href="https://cplusplus.github.io/LWG/issue3815" title="Latest snapshot">(i)</a></sup>.
</p>

<p>
This resolves ballot comment GB-75.
It also partially addresses GB-130 (along with LWG <a href="lwg-defects.html#3814" title="Add freestanding items requested by NB comments (Status: C++23)">3814</a><sup><a href="https://cplusplus.github.io/LWG/issue3814" title="Latest snapshot">(i)</a></sup>).
</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>.
</p>

<ol>
<li><p>Modify  [freestanding.entity] as indicated:</p>

<blockquote class="note">
<p>
[<i>Drafting note:</i> Replace the section name [freestanding.entity] by [freestanding.item] throughout the working draft]
</p>
</blockquote>

<blockquote>
<p>
<b>16.3.3.6 Freestanding <del>entities</del><ins>items</ins> [freestanding.<ins>item</ins><del>entity</del>]</b>
<p/>
-1- A <i>freestanding <del>entity</del><ins>item</ins></i> is <del>a declaration</del><ins>an entity</ins> or
macro definition that is present in a freestanding implementation and a hosted implementation.
<p/>
-2- Unless otherwise specified, the requirements on freestanding <del>entities</del><ins>items, except namespaces,</ins> 
<del>on</del><ins>for</ins> a freestanding implementation are the same as the corresponding requirements <del>in</del><ins>for</ins> 
a hosted implementation.
<p/>
<ins>[<i>Note</i>: This implies that freestanding item enumerations have the same enumerators on freestanding implementations 
and hosted implementations. Furthermore, class types have the same deduction guides and members on freestanding implementations 
and hosted implementations. &mdash; <i>end note</i>]</ins>
<p/>
<ins>-3- An entity is a freestanding item, if it is:</ins>
<ol style="list-style-type: none">
<li><p><ins>(3.1) &mdash; introduced by a declaration in the header synopsis, and</ins></p>
<ol style="list-style-type: none">
<li><p><ins>(3.1.1) &mdash; the declaration is followed by a comment that includes <i>freestanding</i>, or</ins></p></li>
<li><p><ins>(3.1.2) &mdash; the header synopsis begins with a comment that includes <i>all freestanding</i>;</ins></p></li>
</ol></li>
<li><p><ins>(3.2) &mdash; an enclosing namespace of a freestanding item,</ins></p></li>
<li><p><ins>(3.3) &mdash; a friend of a freestanding item,</ins></p></li>
<li><p><ins>(3.4) &mdash; denoted by a <i>typedef-name</i>, that is a freestanding item, or</ins></p></li>
<li><p><ins>(3.5) &mdash; denoted by a template alias, that is a freestanding item.</ins></p></li>
</ol>
<p/>
<ins>-4- A macro definition is a freestanding item, if it is defined in the header synopsis and</ins>
<ol style="list-style-type: none">
<li><p><ins>(4.1) &mdash; the definition is followed by a comment that includes <i>freestanding</i> in the header synopsis, or</ins></p></li>
<li><p><ins>(4.2) &mdash; the header synopsis begins with a comment that includes <i>all freestanding.</i></ins></p></li>
</ol>
<p/>
<del>-3- In a header synopsis, entities followed with a comment that includes <i>freestanding</i> are freestanding entities.</del>
<p/>
[<i>Example 1</i>: &hellip; &mdash; <i>end example</i>]
<p/>
<del>-4- If a header synopsis begins with a comment that includes <i>all freestanding</i>,
 then all of the declarations and macro definitions in the header synopsis are freestanding entities..</del>
<p/>
[<i>Example 2</i>: &hellip; &mdash; <i>end example</i>]
<p/>
<del>-5- Deduction guides for freestanding entity class templates are freestanding
entities.</del>
<p/>
<del>-6- Enclosing namespaces of freestanding entities are freestanding entities.</del>
<p/>
<del>-7- Friends of freestanding entities are freestanding entities.</del>
<p/>
<del>-8- Entities denoted by freestanding entity <i>typedef-name</i>s and freestanding entity alias templates are freestanding entities.</del>
</p>
</blockquote>
</li>

<li><p>Modify 16.4.2.5 <a href="https://wg21.link/compliance">[compliance]</a> as indicated:</p>

<blockquote>
<p>
-3- For each of the headers listed in Table 28, a freestanding implementation provides at least the freestanding
<del>entities</del><ins>items</ins> (16.3.3.6 <a href="https://wg21.link/freestanding.entity">[freestanding.<del>entity</del><ins>item</ins>]</a>) 
declared in the header.
</p>
</blockquote>
</li>

<li><p>Modify 22.10.15.5 <a href="https://wg21.link/func.bind.place">[func.bind.place]</a> as indicated:</p>

<blockquote>
<p>
-3- Placeholders are freestanding <del>entities</del><ins>items</ins> 
(16.3.3.6 <a href="https://wg21.link/freestanding.entity">[freestanding.<del>entity</del><ins>item</ins>]</a>).
</p>
</blockquote>
</li>
</ol>

</blockquote>

<p><i>[2022-11-10; Tomasz provide improved wording]</i></p>

<p>
Updated wording to support freestanding <i>typedef-name</i>s and using declaration that are not entities.
It still addresses both 3753 and LWG <a href="lwg-defects.html#3815" title="Freestanding enumerators specification is lacking (Status: Resolved)">3815</a><sup><a href="https://cplusplus.github.io/LWG/issue3815" title="Latest snapshot">(i)</a></sup>.
</p>

<p>
This resolves ballot comment GB-75.
It also partially addresses GB-130 (along with LWG <a href="lwg-defects.html#3814" title="Add freestanding items requested by NB comments (Status: C++23)">3814</a><sup><a href="https://cplusplus.github.io/LWG/issue3814" title="Latest snapshot">(i)</a></sup>).
</p>

<p><i>[Kona 2022-11-10; Move to Immediate]</i></p>


<p><i>[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Immediate &rarr; WP.]</i></p>




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

<p>
This wording is relative to <a href="https://wg21.link/N4917" title=" Working Draft, Standard for Programming Language C++">N4917</a>.
</p>

<ol>
<li><p>Modify  [freestanding.entity] as indicated:</p>

<blockquote class="note">
<p>
[<i>Drafting note:</i> Replace the section name [freestanding.entity] by [freestanding.item] throughout the working draft]
</p>
</blockquote>

<blockquote>
<p>
<b>16.3.3.6 Freestanding <del>entities</del><ins>items</ins> [freestanding.<ins>item</ins><del>entity</del>]</b>
<p/>
-1- A <i>freestanding <del>entity</del><ins>item</ins></i> is a declaration<ins>, entity, <i>typedef-name</i>, </ins> or
macro <del>definition</del> that is <ins>required to be</ins> present in a freestanding implementation and a hosted implementation.
<p/>
-2- Unless otherwise specified, the requirements on freestanding <del>entities</del><ins>items</ins> 
<del>on</del><ins>for</ins> a freestanding implementation are the same as the corresponding requirements <del>in</del><ins>for</ins> 
a hosted implementation<ins>, except that not all of the members of the namespaces are required to be present</ins>.
<p/>
<ins>[<i>Note</i>: This implies that freestanding item enumerations have the same enumerators on freestanding implementations 
and hosted implementations. Furthermore, class types have the same members and class templates have the same deduction guides
on freestanding implementations and hosted implementations. &mdash; <i>end note</i>]</ins>
<p/>
<ins>-3- A declaration in a header synopsis is a freestanding item if</ins>
<ol style="list-style-type: none">
<li><p><ins>(3.1) &mdash; it is followed by a comment that includes <i>freestanding</i>, or</ins></p></li>
<li><p><ins>(3.1) &mdash; the header synopsis begins with a comment that includes <i>all freestanding</i>.</ins></p></li>
</ol>
<p/>
<ins>-4- An entity or <i>typedef-name</i> is a freestanding item if it is:</ins>
<ol style="list-style-type: none">
<li><p><ins>(4.1) &mdash; introduced by a declaration that is a freestanding item,</ins></p></li>
<li><p><ins>(4.2) &mdash; an enclosing namespace of a freestanding item,</ins></p></li>
<li><p><ins>(4.3) &mdash; a friend of a freestanding item,</ins></p></li>
<li><p><ins>(4.4) &mdash; denoted by a <i>typedef-name</i> that is a freestanding item, or</ins></p></li>
<li><p><ins>(4.5) &mdash; denoted by an alias template that is a freestanding item.</ins></p></li>
</ol>
<p/>
<ins>-5- A macro is a freestanding item if it is defined in a header synopsis and</ins>
<ol style="list-style-type: none">
<li><p><ins>(5.1) &mdash; the definition is followed by a comment that includes <i>freestanding</i>, or</ins></p></li>
<li><p><ins>(5.2) &mdash; the header synopsis begins with a comment that includes <i>all freestanding.</i></ins></p></li>
</ol>
<p/>
<del>-3- In a header synopsis, entities followed with a comment that includes <i>freestanding</i> are freestanding entities.</del>
<p/>
[<i>Example 1</i>: &hellip; &mdash; <i>end example</i>]
<p/>
<del>-4- If a header synopsis begins with a comment that includes <i>all freestanding</i>,
 then all of the declarations and macro definitions in the header synopsis are freestanding entities..</del>
<p/>
[<i>Example 2</i>: &hellip; &mdash; <i>end example</i>]
<p/>
<del>-5- Deduction guides for freestanding entity class templates are freestanding
entities.</del>
<p/>
<del>-6- Enclosing namespaces of freestanding entities are freestanding entities.</del>
<p/>
<del>-7- Friends of freestanding entities are freestanding entities.</del>
<p/>
<del>-8- Entities denoted by freestanding entity <i>typedef-name</i>s and freestanding entity alias templates are freestanding entities.</del>
</p>
</blockquote>
</li>

<li><p>Modify 16.4.2.5 <a href="https://wg21.link/compliance">[compliance]</a> as indicated:</p>

<blockquote>
<p>
-3- For each of the headers listed in Table 28, a freestanding implementation provides at least the freestanding
<del>entities</del><ins>items</ins> (16.3.3.6 <a href="https://wg21.link/freestanding.entity">[freestanding.<del>entity</del><ins>item</ins>]</a>) 
declared in the header.
</p>
</blockquote>
</li>

<li><p>Modify 22.10.15.5 <a href="https://wg21.link/func.bind.place">[func.bind.place]</a> as indicated:</p>

<blockquote>
<p>
-3- Placeholders are freestanding <del>entities</del><ins>items</ins> 
(16.3.3.6 <a href="https://wg21.link/freestanding.entity">[freestanding.<del>entity</del><ins>item</ins>]</a>).
</p>
</blockquote>
</li>
</ol>






</body>
</html>
