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.

3132. Library needs to ban macros named expects or ensures

Section: 16.4.5.3.3 [macro.names] Status: C++20 Submitter: Tim Song Opened: 2018-06-30 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:

expects and ensures are not technically described as attribute-tokens when used in a contract-attribute-specifier, so the existing prohibition in 16.4.5.3.3 [macro.names] doesn't apply to them.

The remaining special identifiers used by the contract attributes are all already covered by existing wording: assert is also a library name so falls under p1, default is a keyword, and both axiom and audit were added to Table 4.

[2018-07-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.

  1. Change 16.4.5.3.3 [macro.names] p2 as indicated:

    -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], or to the identifiers expects or ensures.