public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111072] New: Splicing at the end fails
@ 2023-08-19 4:16 verodeving at gmail dot com
2023-08-19 4:40 ` [Bug preprocessor/111072] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: verodeving at gmail dot com @ 2023-08-19 4:16 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug preprocessor/111072] Splicing at the end fails
2023-08-19 4:16 [Bug c++/111072] New: Splicing at the end fails verodeving at gmail dot com
@ 2023-08-19 4:40 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-19 4:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111072
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-08-19
Status|UNCONFIRMED |NEW
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note C17 has:
A source file that is not empty shall end in a new-line character, which shall
not be immediately preceded by a backslash character before any such splicing
takes place.
C++11, C++17 and C++20:
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.
So this is a difference between C++ and C :).
And GCC just misses that point out.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-19 4:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-19 4:16 [Bug c++/111072] New: Splicing at the end fails verodeving at gmail dot com
2023-08-19 4:40 ` [Bug preprocessor/111072] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).