This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.

3753. Clarify entity vs. freestanding entity

Section: 16.3.3.6 [freestanding.item] Status: C++23 Submitter: Ben Craig Opened: 2022-08-23 Last modified: 2023-11-22

Priority: 2

View all other issues in [freestanding.item].

View all issues with C++23 status.

Discussion:

This addresses NB comment GB-075 ( [freeestanding.entity] "Freestanding entities" are not entities)

[freestanding.entity] p1 defines a freestanding entity as a declaration or macro definition.

[freestanding.entity] p3 then says "entities followed with a comment […] are freestanding entities".

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

[2022-09-23; Reflector poll]

Set priority to 2 after reflector poll.

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.

"freestanding entities" is not best name, given the collision with core entity, but I think that this is separable issue.

[2022-09-28; Reflector poll]

Set status to Tentatively Ready after five votes in favour during reflector poll.

Previous resolution [SUPERSEDED]:

This wording is relative to the forthcoming C++23 CD.

[2022-11-06; Ben Craig provides new wording]

[2022-11-07; Kona - move to open]

New proposed resolution to be added.

Previous resolution [SUPERSEDED]:

This wording is relative to N4917.

  1. Modify [freestanding.entity] as indicated:

    [Drafting note: Replace the section name [freestanding.entity] by [freestanding.item] throughout the working draft]

    16.3.3.6 Freestanding entitiesitems [freestanding.itementity]

    -1- A freestanding entityitem is a declarationan entity or macro definition that is present in a freestanding implementation and a hosted implementation.

    -2- Unless otherwise specified, the requirements on freestanding entitiesitems on a freestanding implementation are the same as the corresponding requirements in a hosted implementation.

    -3- In a header synopsis, entities introduced by declarations followed with a comment that includes freestanding are freestanding entitiesitems.

    -?- In a header synopsis, macro definitions followed with a comment that includes freestanding are freestanding items.

    […]

    -4- If a header synopsis begins with a comment that includes all freestanding, then all of the entities introduced by declarations and macro definitions in the header synopsis are freestanding entitiesitems.

    -?- If a header synopsis begins with a comment that includes all freestanding, then all of the macro definitions in the header synopsis are freestanding items.

    […]

    -5- Deduction guides for freestanding entityitem class templates are freestanding entitiesitems.

    -6- Enclosing namespaces of freestanding entitiesitems are freestanding entitiesitems.

    -7- Friends of freestanding entitiesitems are freestanding entitiesitems.

    -8- Entities denoted by freestanding entityitem typedef-names and freestanding entityitem alias templates are freestanding entitiesitems.

  2. Modify 16.4.2.5 [compliance] as indicated:

    -3- For each of the headers listed in Table 28, a freestanding implementation provides at least the freestanding entitiesitems ( [freestanding.entity]) declared in the header.

  3. Modify 22.10.15.5 [func.bind.place] as indicated:

    -3- Placeholders are freestanding entitiesitems ( [freestanding.entity]).

[2022-11-08; Ben Craig provides improved wording]

This combined resolution addresses both 3753 and LWG 3815, and has already been reviewed by LWG.

This resolves ballot comment GB-75. It also partially addresses GB-130 (along with LWG 3814).

Previous resolution [SUPERSEDED]:

This wording is relative to N4917.

  1. Modify 16.3.3.6 [freestanding.entity] as indicated:

    [Drafting note: Replace the section name [freestanding.entity] by [freestanding.item] throughout the working draft]

    16.3.3.6 Freestanding entitiesitems [freestanding.itementity]

    -1- A freestanding entityitem is a declarationan entity or macro definition that is present in a freestanding implementation and a hosted implementation.

    -2- Unless otherwise specified, the requirements on non-namespace freestanding entitiesitems on a freestanding implementation are the same as the corresponding requirements in a hosted implementation.

    [Note: 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. — end note]

    -3- In a header synopsis, entities each entity introduced by a declaration followed withby a comment that includes freestanding areis a freestanding entitiesitem.

    -?- In a header synopsis, each macro definition followed by a comment that includes freestanding is a freestanding item.

    […]

    -4- If a header synopsis begins with a comment that includes all freestanding, then all of the declarations and macro definitionseach entity introduced by a declaration in the header synopsis areis a freestanding entitiesitem.

    -?- If a header synopsis begins with a comment that includes all freestanding, then each macro definition in the header synopsis is a freestanding item.

    […]

    -5- Deduction guides for freestanding entity class templates are freestanding entities.

    -6- Enclosing namespaces of freestanding entities are freestanding entities. Each enclosing namespace of each freestanding item is a freestanding item.

    -7- Friends of freestanding entities are freestanding entities. Each friend of each freestanding item is a freestanding item.

    -8- Entities denoted by freestanding entity typedef-names and freestanding entity alias templates are freestanding entities. Each entity denoted by each freestanding item typedef-name and each freestanding item alias template is a freestanding item.

  2. Modify 16.4.2.5 [compliance] as indicated:

    -3- For each of the headers listed in Table 28, a freestanding implementation provides at least the freestanding entitiesitems (16.3.3.6 [freestanding.entityitem]) declared in the header.

  3. Modify 22.10.15.5 [func.bind.place] as indicated:

    -3- Placeholders are freestanding entitiesitems (16.3.3.6 [freestanding.entityitem]).

[2022-11-09; Ben Craig and Tomasz provide improved wording]

This new resolution merges definition of freestanding item for entity in macro into bullet lists. It still addresses both 3753 and LWG 3815.

This resolves ballot comment GB-75. It also partially addresses GB-130 (along with LWG 3814).

Previous resolution [SUPERSEDED]:

This wording is relative to N4917.

  1. Modify [freestanding.entity] as indicated:

    [Drafting note: Replace the section name [freestanding.entity] by [freestanding.item] throughout the working draft]

    16.3.3.6 Freestanding entitiesitems [freestanding.itementity]

    -1- A freestanding entityitem is a declarationan entity or macro definition that is present in a freestanding implementation and a hosted implementation.

    -2- Unless otherwise specified, the requirements on freestanding entitiesitems, except namespaces, onfor a freestanding implementation are the same as the corresponding requirements infor a hosted implementation.

    [Note: 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. — end note]

    -3- An entity is a freestanding item, if it is:

    1. (3.1) — introduced by a declaration in the header synopsis, and

      1. (3.1.1) — the declaration is followed by a comment that includes freestanding, or

      2. (3.1.2) — the header synopsis begins with a comment that includes all freestanding;

    2. (3.2) — an enclosing namespace of a freestanding item,

    3. (3.3) — a friend of a freestanding item,

    4. (3.4) — denoted by a typedef-name, that is a freestanding item, or

    5. (3.5) — denoted by a template alias, that is a freestanding item.

    -4- A macro definition is a freestanding item, if it is defined in the header synopsis and

    1. (4.1) — the definition is followed by a comment that includes freestanding in the header synopsis, or

    2. (4.2) — the header synopsis begins with a comment that includes all freestanding.

    -3- In a header synopsis, entities followed with a comment that includes freestanding are freestanding entities.

    [Example 1: … — end example]

    -4- If a header synopsis begins with a comment that includes all freestanding, then all of the declarations and macro definitions in the header synopsis are freestanding entities..

    [Example 2: … — end example]

    -5- Deduction guides for freestanding entity class templates are freestanding entities.

    -6- Enclosing namespaces of freestanding entities are freestanding entities.

    -7- Friends of freestanding entities are freestanding entities.

    -8- Entities denoted by freestanding entity typedef-names and freestanding entity alias templates are freestanding entities.

  2. Modify 16.4.2.5 [compliance] as indicated:

    -3- For each of the headers listed in Table 28, a freestanding implementation provides at least the freestanding entitiesitems (16.3.3.6 [freestanding.entityitem]) declared in the header.

  3. Modify 22.10.15.5 [func.bind.place] as indicated:

    -3- Placeholders are freestanding entitiesitems (16.3.3.6 [freestanding.entityitem]).

[2022-11-10; Tomasz provide improved wording]

Updated wording to support freestanding typedef-names and using declaration that are not entities. It still addresses both 3753 and LWG 3815.

This resolves ballot comment GB-75. It also partially addresses GB-130 (along with LWG 3814).

[Kona 2022-11-10; Move to Immediate]

[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Immediate → WP.]

Proposed resolution:

This wording is relative to N4917.

  1. Modify [freestanding.entity] as indicated:

    [Drafting note: Replace the section name [freestanding.entity] by [freestanding.item] throughout the working draft]

    16.3.3.6 Freestanding entitiesitems [freestanding.itementity]

    -1- A freestanding entityitem is a declaration, entity, typedef-name, or macro definition that is required to be present in a freestanding implementation and a hosted implementation.

    -2- Unless otherwise specified, the requirements on freestanding entitiesitems onfor a freestanding implementation are the same as the corresponding requirements infor a hosted implementation, except that not all of the members of the namespaces are required to be present.

    [Note: 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. — end note]

    -3- A declaration in a header synopsis is a freestanding item if

    1. (3.1) — it is followed by a comment that includes freestanding, or

    2. (3.1) — the header synopsis begins with a comment that includes all freestanding.

    -4- An entity or typedef-name is a freestanding item if it is:

    1. (4.1) — introduced by a declaration that is a freestanding item,

    2. (4.2) — an enclosing namespace of a freestanding item,

    3. (4.3) — a friend of a freestanding item,

    4. (4.4) — denoted by a typedef-name that is a freestanding item, or

    5. (4.5) — denoted by an alias template that is a freestanding item.

    -5- A macro is a freestanding item if it is defined in a header synopsis and

    1. (5.1) — the definition is followed by a comment that includes freestanding, or

    2. (5.2) — the header synopsis begins with a comment that includes all freestanding.

    -3- In a header synopsis, entities followed with a comment that includes freestanding are freestanding entities.

    [Example 1: … — end example]

    -4- If a header synopsis begins with a comment that includes all freestanding, then all of the declarations and macro definitions in the header synopsis are freestanding entities..

    [Example 2: … — end example]

    -5- Deduction guides for freestanding entity class templates are freestanding entities.

    -6- Enclosing namespaces of freestanding entities are freestanding entities.

    -7- Friends of freestanding entities are freestanding entities.

    -8- Entities denoted by freestanding entity typedef-names and freestanding entity alias templates are freestanding entities.

  2. Modify 16.4.2.5 [compliance] as indicated:

    -3- For each of the headers listed in Table 28, a freestanding implementation provides at least the freestanding entitiesitems (16.3.3.6 [freestanding.entityitem]) declared in the header.

  3. Modify 22.10.15.5 [func.bind.place] as indicated:

    -3- Placeholders are freestanding entitiesitems (16.3.3.6 [freestanding.entityitem]).