Files ending in \
5.2 [lex.phases]
David Krauss

Created on 2013-06-10.00:00:00 last changed 3 months ago


Date: 2023-07-14.22:00:05

CWG 2023-07-14

Addressed by the resolution for issue 2747.

Date: 2023-11-15.00:00:00

[Accepted as a DR at the November, 2023 meeting.]

The description of how to handle file not ending in a newline in 5.2 [lex.phases] paragraph 1, phase 2, is:

  1. Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines. Only the last backslash on any physical source line shall be eligible for being part of such a splice. If, as a result, a character sequence that matches the syntax of a universal-character-name is produced, the behavior is undefined. A source file that is not empty and that does not end in a new-line character, or that ends in a new-line character immediately preceded by a backslash character before any such splicing takes place, shall be processed as if an additional new-line character were appended to the file.

This is not clear regarding what happens if the last character in the file is a backslash. In such a case, presumably the result of adding the newline should not be a line splice but rather a backslash preprocessing-token (that will be diagnosed as an invalid token in phase 7), but that should be spelled out.

Date User Action Args
2024-04-05 21:43:46adminsetstatus: dr -> drwp
2023-12-19 10:15:28adminsetstatus: ready -> dr
2023-07-14 22:00:05adminsetmessages: + msg7365
2023-07-14 22:00:05adminsetstatus: open -> ready
2013-06-10 00:00:00admincreate