This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


2575. Undefined behavior when macro-replacing "defined" operator

Section: 15.2  [cpp.cond]     Status: open     Submitter: US     Date: 2019-10-23     Liaison: SG12

(From National Body comment US 130 on the C++20 DIS.)

Subclause 15.2 [cpp.cond] paragraph 10 specifies:

If the token defined is generated as a result of this replacement process or use of the defined unary operator does not match one of the two specified forms prior to macro replacement, the behavior is undefined.

Undefined behavior during lexing is not acceptable. The behavior ought to be well-defined, ill-formed, or conditionally-supported.

Additional notes (January, 2023):

Forwarded to SG12 with paper issue 1407, by decision of the CWG and SG12 chairs.