On Thu, Mar 25, 2021 at 4:34 PM Tom Honermann <tom@honermann.net> wrote:
It looks like the current text addresses this. From 1655 "Is it intended that, for example, a CRLF in the source of a raw string literal is to be represented as a newline character or as the original characters?"There are two CWG issues related to this:
From the current draft: http://eel.is/c++draft/lex.string#4
[Note 2:A source-file new-line in a raw string literal results in a new-line in the resulting execution string literal.Assuming no whitespace at the beginning of lines in the following example, the assert will succeed:const char* p = R"(a\ b c)"; assert(std::strcmp(p, "a\\\nb\nc") == 0);— end note]
It does look that way, but this wording also predates the core
issue. Perhaps that wording went unnoticed when the issue was
recorded. I did some brief tests and, assuming I didn't mess it
up, it looks like the assert passes for gcc (9.1), Clang (7.0),
and Visual C++ (2019 16.7) when presented a source file with CRLF
line endings. Perhaps this issue can be resolved as NAD. I sent
a message to CWG.
Tom.