3132. Library needs to ban macros named expects or ensures

Section: [macro.names] Status: C++20 Submitter: Tim Song Opened: 2018-06-30 Last modified: 2021-02-25 10:48:01 UTC

Priority: 0

View all other issues in [macro.names].

View all issues with C++20 status.


expects and ensures are not technically described as attribute-tokens when used in a contract-attribute-specifier, so the existing prohibition in [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 [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.