https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127488
Bug ID: 127488
Summary: Raw string literal loses whitespace between backslash
and newline
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: bic60176 at gmail dot com
Target Milestone: ---
static const char a[] = R"(\
X)";
static const char b[] = "\\\t\t\nX";
int main()
{
return sizeof(a) == sizeof(b) &&
__builtin_memcmp(a, b, sizeof(a)) == 0 ? 0 : 1;
}
g++ -std=c++23 -w test.cc -o test && ./test
echo $?
Actual: returns 1; the tab run is changed into a single space.
Expected: returns 0; raw-string contents should preserve the whitespace.