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

2024-05-06


2580. Undefined behavior with #line

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

(From National Body comments US 144 and US 145 on the C++20 DIS.)

Subclause 15.7 [cpp.line] paragraph 3 specifies:

If the digit sequence specifies zero or a number greater than 2147483647, the behavior is undefined.

Subclause 15.7 [cpp.line] paragraph 5 specifies:

If the directive resulting after all replacements does not match one of the two previous forms, the behavior is undefined; otherwise, the result is processed as appropriate.

Undefined behavior during lexing is not acceptable. This ought to be ill-formed.

Additional notes (January, 2023):

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