On 8/1/25 12:52 PM, Jakub Jelinek wrote:
Hi!
The CWG1709 just codifies existing GCC (and clang) behavior, so this
just adds a testcase for that.
Tested on x86_64-linux, ok for trunk?
OK.
2025-08-01 Jakub Jelinek <ja...@redhat.com>
PR preprocessor/120778
* g++.dg/DRs/dr1709.C: New test.
--- gcc/testsuite/g++.dg/DRs/dr1709.C.jj 2025-08-01 18:23:24.646909730
+0200
+++ gcc/testsuite/g++.dg/DRs/dr1709.C 2025-08-01 18:39:31.107702971 +0200
@@ -0,0 +1,18 @@
+// DR 1709 - Stringizing raw string literals containing newline
+// { dg-do run { target c++26 } }
+
+#define A(a) #a
+const char *a = A(a\f\\b"c");
+const char *b = A(R"abc(a\b
+
+)abc");
+
+int
+main ()
+{
+ if (a[1] != '\f' || a[2] != '\\' || a[4] != '"' || a[6] != '"')
+ __builtin_abort ();
+ if (b[1] != '"' || b[7] != '\\' || b[9] != '\n' || b[10] != '\n'
+ || b[11] != ')' || b[15] != '"')
+ __builtin_abort ();
+}
Jakub