https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111072
Bug ID: 111072
Summary: Splicing at the end fails
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: verodeving at gmail dot com
Target Milestone: ---
The following code fails under GCC(trunk) and the compiler options -Wall
-Werror -Wextra -pedantic-errors -Wpedantic -O3 -std=c++23(untested under other
compiler options or other GCC versions):
int \
a;
An example of the failure can be seen at https://godbolt.org/z/WhKK7rYne
This behaviour is incorrect because https://eel.is/c++draft/lex.phases#1.2
mentions the following:
- A source file that is not empty and that does not end in a new-line
character, or that ends in a splice, shall be processed as if an additional
new-line character were appended to the file.
Therefore, the backslash at the end of the file shouldn't error because it
should behave as a new line was appended at the end of the file, according to
the mentioned standard paragraph.