This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Accepted as a DR at the June, 2024 meeting.]
Subclause 5.10 [lex.name] paragraph 3 specifies:
In addition, some identifiers appearing as a token or preprocessing-token are reserved for use by C++ implementations and shall not be used otherwise; no diagnostic is required.
- Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use.
- Each identifier that begins with an underscore is reserved to the implementation for use as a name in the global namespace.
That implies that uses of standard-specified predefined macros (15.11 [cpp.predefined]) or feature-test macros (17.3.2 [version.syn]) make the program ill-formed. This does not appear to be the intent.
Proposed resolution (approved by CWG 2024-01-19) [SUPERSEDED]:
Change in 5.10 [lex.name] paragraph 3 and add bullets as follows:
In addition, some identifiers appearing as a token or preprocessing-token are reserved for use by C++ implementations and shall not be used otherwise; no diagnostic is required.
- Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use, except for
- the macros specified in 15.11 [cpp.predefined],
- the function-local predefined variable (9.5.1 [dcl.fct.def.general]), and
- the macros and identifiers declared in the standard library as specified in Clause 17 [support] through Clause 33 [thread], and Clause Annex D [depr]. [ Note: This affects macros in 17.3.2 [version.syn], 31.13.1 [cstdio.syn], and D.11 [depr.c.macros] as well as identifiers in 17.2.2 [cstdlib.syn]. -- end note ]
- Each identifier that begins with an underscore is reserved to the implementation for use as a name in the global namespace.
CWG 2024-03-20
The exceptions should not be specified using a specific list, which might become stale in the future.
Proposed resolution (approved by CWG 2024-03-20):
Change in 5.10 [lex.name] paragraph 3 and add bullets as follows:
In addition, some identifiers appearing as a token or preprocessing-token are reserved for use by C++ implementations and shall not be used otherwise; no diagnostic is required.
- Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter, other than those specified in this document (for example, __cplusplus (15.11 [cpp.predefined])), is reserved to the implementation for any use.
- Each identifier that begins with an underscore is reserved to the implementation for use as a name in the global namespace.