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

3883. §[support.c.headers.other] Ambiguity in the requirements for includes

Section: 17.14.7 [support.c.headers.other] Status: New Submitter: Alex Mills Opened: 2023-02-09 Last modified: 2023-03-22

Priority: 4

View other active issues in [support.c.headers.other].

View all other issues in [support.c.headers.other].

View all issues with New status.

Discussion:

In 17.14.7 [support.c.headers.other], it states that the <name.h> headers behave "as if each name placed in the standard library namespace by the corresponding header is placed within the global namespace scope". There are exceptions for several different definitions in the headers, but it's left ambiguous as to whether their inclusion in the <name.h> headers is required or unspecified.

While it is clear that, for example, ::byte is prohibited, it isn't clear whether std::byte is required to be included at all (this applies to the other listed exceptions as well). Though example 1 makes it appear that their inclusion requirements are meant to be left unspecified, paragraph 1 does not provide clarification. Adding specific wording will ensure this will not be misinterpreted in the future.

To do this, we should append a sentence to [support.c.headers.other] p1:

Whether the listed exceptions are included in their corresponding <name.h> headers under the standard library namespace is unspecified.

[2023-03-22; Reflector poll]

Set priority to 4 after reflector poll. "The new wording is confusingly inconsistent with the existing wording in that paragraph. Would prefer '... Whether the listed exceptions are declared in the namespace std by their corresponding <name.h> headers is unspecified.'."

Proposed resolution:

This wording is relative to N4928.

  1. Modify 17.14.7 [support.c.headers.other] as indicated:

    -1- Every C header other than <complex.h> (17.14.2 [complex.h.syn]), <iso646.h> (17.14.3 [iso646.h.syn]), <stdalign.h> (17.14.4 [stdalign.h.syn]), <stdatomic.h> (32.5.12 [stdatomic.h.syn]), <stdbool.h> (17.14.5 [stdbool.h.syn]), and <tgmath.h> (17.14.6 [tgmath.h.syn]), each of which has a name of the form <name.h>, behaves as if each name placed in the standard library namespace by the corresponding <cname> header is placed within the global namespace scope, except for the functions described in 29.7.6 [sf.cmath], the std::lerp function overloads (29.7.4 [c.math.lerp]), the declaration of std::byte (17.2.1 [cstddef.syn]), and the functions and function templates described in 17.2.5 [support.types.byteops]. It is unspecified whether these names are first declared or defined within namespace scope (6.4.6 [basic.scope.namespace]) of the namespace std and are then injected into the global namespace scope by explicit using-declarations (9.9 [namespace.udecl]). Whether the listed exceptions are included in their corresponding <name.h> headers under the standard library namespace is unspecified.