This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
Section: 16.4.5.3.3 [macro.names] Status: C++20 Submitter: Casey Carter Opened: 2018-08-01 Last modified: 2021-02-25
Priority: 0
View other active issues in [macro.names].
View all other issues in [macro.names].
View all issues with C++20 status.
Discussion:
16.4.5.3.3 [macro.names]/2 forbids a translation unit to define names "lexically identical to […] the
attribute-tokens described in 9.12 [dcl.attr]." We recently added the attribute-tokens likely
and unlikely
(9.12.8 [dcl.attr.likelihood]). These names are in extremely wide use as function-like
macros in the open source community, forbidding users to define them breaks large amounts of code. (Reportedly
Chromium contains 19 definitions each of "likely" and "unlikely" as function-like macros.)
[[likely]]
and
[[unlikely]]
attributes.
[2018-08-20 Status to Tentatively Ready after five positive votes on the reflector.]
[2018-11, Adopted in San Diego]
Proposed resolution:
This wording is relative to N4762.
Change 16.4.5.3.3 [macro.names] as indicated:
[Drafting Note: If both this proposed resolution and the proposed resolution of LWG 3132(i) are accepted, the text inserted by LWG 3132(i) should precede the text added here.]
-2- A translation unit shall not
#define
or#undef
names lexically identical to keywords, to the identifiers listed in Table 4, or to the attribute-tokens described in 9.12 [dcl.attr], except that the nameslikely
andunlikely
may be defined as function-like macros (15.6 [cpp.replace]).