--- libcpp/lex.cc.jj	2024-07-17 11:36:49.897873247 +0200
+++ libcpp/lex.cc	2024-07-17 20:04:43.936793506 +0200
@@ -2718,7 +2718,10 @@ lex_raw_string (cpp_reader *pfile, cpp_t
 		       || c == '*' || c == '+' || c == '-' || c == '/'
 		       || c == '^' || c == '&' || c == '|' || c == '~'
 		       || c == '!' || c == '=' || c == ','
-		       || c == '"' || c == '\''))
+		       || c == '"' || c == '\''
+		       || ((c == '$' || c == '@' || c == '`')
+			   && CPP_OPTION (pfile, cplusplus)
+			   && CPP_OPTION (pfile, lang) > CLK_CXX23)))
 	    prefix[prefix_len++] = c;
 	  else
 	    {
--- libcpp/charset.cc.jj	2024-01-05 08:35:13.696827331 +0100
+++ libcpp/charset.cc	2024-07-17 20:18:13.665467035 +0200
@@ -1808,7 +1808,12 @@ _cpp_valid_ucn (cpp_reader *pfile, const
       result = 1;
     }
   else if (identifier_pos && result == 0x24 
-	   && CPP_OPTION (pfile, dollars_in_ident))
+	   && CPP_OPTION (pfile, dollars_in_ident)
+	   /* In C++26 when dollars are allowed in identifiers,
+	      we should still reject \u0024 as $ is part of the basic
+	      character set.  */
+	   && !(CPP_OPTION (pfile, cplusplus)
+		&& CPP_OPTION (pfile, lang) > CLK_CXX23))
     {
       if (CPP_OPTION (pfile, warn_dollars) && !pfile->state.skipping)
 	{
--- gcc/testsuite/c-c++-common/raw-string-1.c.jj	2020-01-12 11:54:37.022404221 +0100
+++ gcc/testsuite/c-c++-common/raw-string-1.c	2024-07-17 20:31:02.272652757 +0200
@@ -1,7 +1,6 @@
-// { dg-do run }
+// { dg-do run { target { c || c++11 } } }
 // { dg-require-effective-target wchar }
 // { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
-// { dg-options "-std=c++0x" { target c++ } }
 
 #ifndef __cplusplus
 #include <wchar.h>
--- gcc/testsuite/c-c++-common/raw-string-2.c.jj	2020-01-12 11:54:37.023404206 +0100
+++ gcc/testsuite/c-c++-common/raw-string-2.c	2024-07-17 20:31:18.415446546 +0200
@@ -1,7 +1,6 @@
-// { dg-do run }
+// { dg-do run { target { c || c++11 } } }
 // { dg-require-effective-target wchar }
 // { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
-// { dg-options "-std=c++0x" { target c++ } }
 
 #ifndef __cplusplus
 #include <wchar.h>
--- gcc/testsuite/c-c++-common/raw-string-4.c.jj	2020-01-12 11:54:37.023404206 +0100
+++ gcc/testsuite/c-c++-common/raw-string-4.c	2024-07-17 20:31:51.590022777 +0200
@@ -1,7 +1,6 @@
 // R is not applicable for character literals.
-// { dg-do compile }
+// { dg-do compile { target { c || c++11 } } }
 // { dg-options "-std=gnu99" { target c } }
-// { dg-options "-std=c++0x" { target c++ } }
 
 const int	i0	= R'a';	// { dg-error "was not declared|undeclared" "undeclared" }
 		// { dg-error "expected ',' or ';'" "expected" { target c } .-1 }
--- gcc/testsuite/c-c++-common/raw-string-5.c.jj	2020-07-28 15:39:09.992756448 +0200
+++ gcc/testsuite/c-c++-common/raw-string-5.c	2024-07-17 20:56:46.522822013 +0200
@@ -1,6 +1,5 @@
-// { dg-do compile }
+// { dg-do compile { target { c || c++11 } } }
 // { dg-options "-std=gnu99" { target c } }
-// { dg-options "-std=c++0x" { target c++ } }
 
 const void *s0 = R"0123456789abcdefg()0123456789abcdefg" 0;
 	// { dg-error "raw string delimiter longer" "longer" { target *-*-* } .-1 }
@@ -15,12 +14,18 @@ const void *s3 = R")())" 0;
 	// { dg-error "invalid character" "invalid" { target *-*-* } .-1 }
 	// { dg-error "stray" "stray" { target *-*-* } .-2 }
 const void *s4 = R"@()@" 0;
-	// { dg-error "invalid character" "invalid" { target *-*-* } .-1 }
-	// { dg-error "stray" "stray" { target *-*-* } .-2 }
+	// { dg-error "invalid character" "invalid" { target { c || c++23_down } } .-1 }
+	// { dg-error "stray" "stray" { target { c || c++23_down } } .-2 }
+	// { dg-error "before numeric constant" "numeric" { target c++26 } .-3 }
 const void *s5 = R"$()$" 0;
-	// { dg-error "invalid character" "invalid" { target *-*-* } .-1 }
-	// { dg-error "stray" "stray" { target *-*-* } .-2 }
-const void *s6 = R"\u0040()\u0040" 0;
+	// { dg-error "invalid character" "invalid" { target { c || c++23_down } } .-1 }
+	// { dg-error "stray" "stray" { target { c || c++23_down } } .-2 }
+	// { dg-error "before numeric constant" "numeric" { target c++26 } .-3 }
+const void *s6 = R"`()`" 0;
+	// { dg-error "invalid character" "invalid" { target { c || c++23_down } } .-1 }
+	// { dg-error "stray" "stray" { target { c || c++23_down } } .-2 }
+	// { dg-error "before numeric constant" "numeric" { target c++26 } .-3 }
+const void *s7 = R"\u0040()\u0040" 0;
 	// { dg-error "invalid character" "invalid" { target *-*-* } .-1 }
 	// { dg-error "stray" "stray" { target *-*-* } .-2 }
 
--- gcc/testsuite/c-c++-common/raw-string-6.c.jj	2020-12-28 12:27:32.500752614 +0100
+++ gcc/testsuite/c-c++-common/raw-string-6.c	2024-07-17 20:32:26.193580759 +0200
@@ -1,6 +1,5 @@
-// { dg-do compile }
+// { dg-do compile { target { c || c++11 } } }
 // { dg-options "-std=gnu99" { target c } }
-// { dg-options "-std=c++0x" { target c++ } }
 
 const void *s0 = R"ouch()ouCh"; 	// { dg-error "unterminated raw string" "unterminated" }
 // { dg-error "at end of input" "end" { target *-*-* } .-1 }
--- gcc/testsuite/c-c++-common/raw-string-11.c.jj	2020-01-12 11:54:37.022404221 +0100
+++ gcc/testsuite/c-c++-common/raw-string-11.c	2024-07-17 20:33:54.236456112 +0200
@@ -1,7 +1,7 @@
 // PR preprocessor/48740
+// { dg-do run { target { c || c++11 } } }
 // { dg-options "-std=gnu99 -trigraphs -save-temps" { target c } }
-// { dg-options "-std=c++0x -save-temps" { target c++ } }
-// { dg-do run }
+// { dg-options "-save-temps" { target c++ } }
 
 int main ()
 {
@@ -9,4 +9,3 @@ int main ()
 			   "foo%sbar%sfred%sbob?""?""?""?""?",
 			   sizeof ("foo%sbar%sfred%sbob?""?""?""?""?"));
 }
-
--- gcc/testsuite/c-c++-common/raw-string-13.c.jj	2020-01-12 11:54:37.022404221 +0100
+++ gcc/testsuite/c-c++-common/raw-string-13.c	2024-07-17 20:34:23.669080145 +0200
@@ -1,8 +1,7 @@
 // PR preprocessor/57620
-// { dg-do run }
+// { dg-do run { target { c || c++11 } } }
 // { dg-require-effective-target wchar }
 // { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
-// { dg-options "-std=c++11" { target c++ } }
 
 #ifndef __cplusplus
 #include <wchar.h>
--- gcc/testsuite/c-c++-common/raw-string-14.c.jj	2020-07-28 15:39:09.992756448 +0200
+++ gcc/testsuite/c-c++-common/raw-string-14.c	2024-07-17 20:34:43.507826727 +0200
@@ -1,7 +1,6 @@
 // PR preprocessor/57620
-// { dg-do compile }
+// { dg-do compile { target { c || c++11 } } }
 // { dg-options "-std=gnu99 -trigraphs" { target c } }
-// { dg-options "-std=c++11" { target c++ } }
 
 const void *s0 = R"abc\
 def()abcdef" 0;
--- gcc/testsuite/c-c++-common/raw-string-15.c.jj	2020-01-12 11:54:37.022404221 +0100
+++ gcc/testsuite/c-c++-common/raw-string-15.c	2024-07-17 20:34:58.994628892 +0200
@@ -1,8 +1,8 @@
 // PR preprocessor/57620
-// { dg-do run }
+// { dg-do run { target { c || c++11 } } }
 // { dg-require-effective-target wchar }
 // { dg-options "-std=gnu99 -Wno-c++-compat -Wtrigraphs" { target c } }
-// { dg-options "-std=gnu++11 -Wtrigraphs" { target c++ } }
+// { dg-options "-Wtrigraphs" { target c++ } }
 
 #ifndef __cplusplus
 #include <wchar.h>
--- gcc/testsuite/c-c++-common/raw-string-16.c.jj	2020-07-28 15:39:09.992756448 +0200
+++ gcc/testsuite/c-c++-common/raw-string-16.c	2024-07-17 20:35:22.387330085 +0200
@@ -1,7 +1,7 @@
 // PR preprocessor/57620
-// { dg-do compile }
+// { dg-do compile { target { c || c++11 } } }
 // { dg-options "-std=gnu99 -Wtrigraphs" { target c } }
-// { dg-options "-std=gnu++11 -Wtrigraphs" { target c++ } }
+// { dg-options "-Wtrigraphs" { target c++ } }
 
 const void *s0 = R"abc\
 def()abcdef" 0;
--- gcc/testsuite/c-c++-common/raw-string-17.c.jj	2020-01-12 11:54:37.022404221 +0100
+++ gcc/testsuite/c-c++-common/raw-string-17.c	2024-07-17 20:35:36.497149845 +0200
@@ -1,7 +1,6 @@
 /* PR preprocessor/57824 */
-/* { dg-do run } */
+/* { dg-do run { target { c || c++11 } } } */
 /* { dg-options "-std=gnu99" { target c } } */
-/* { dg-options "-std=c++11" { target c++ } } */
 
 #define S(s) s
 #define T(s) s "\n"
--- gcc/testsuite/c-c++-common/raw-string-18.c.jj	2020-01-12 11:54:37.022404221 +0100
+++ gcc/testsuite/c-c++-common/raw-string-18.c	2024-07-17 20:35:55.151911555 +0200
@@ -1,7 +1,7 @@
 /* PR preprocessor/57824 */
-/* { dg-do compile } */
+/* { dg-do compile { target { c || c++11 } } } */
 /* { dg-options "-std=gnu99 -fdump-tree-optimized-lineno" { target c } } */
-/* { dg-options "-std=c++11 -fdump-tree-optimized-lineno" { target c++ } } */
+/* { dg-options "-fdump-tree-optimized-lineno" { target c++ } } */
 
 const char x[] = R"(
 abc
--- gcc/testsuite/c-c++-common/raw-string-19.c.jj	2020-01-12 11:54:37.022404221 +0100
+++ gcc/testsuite/c-c++-common/raw-string-19.c	2024-07-17 20:36:25.445524589 +0200
@@ -1,7 +1,7 @@
 /* PR preprocessor/57824 */
-/* { dg-do compile } */
+// { dg-do compile { target { c || c++11 } } }
 /* { dg-options "-std=gnu99 -fdump-tree-optimized-lineno -save-temps" { target c } } */
-/* { dg-options "-std=c++11 -fdump-tree-optimized-lineno -save-temps" { target c++ } } */
+/* { dg-options "-fdump-tree-optimized-lineno -save-temps" { target c++ } } */
 
 const char x[] = R"(
 abc
--- gcc/testsuite/g++.dg/cpp26/raw-string1.C.jj	2024-07-17 20:46:06.878052479 +0200
+++ gcc/testsuite/g++.dg/cpp26/raw-string1.C	2024-07-17 20:47:50.761715122 +0200
@@ -0,0 +1,4 @@
+// C++26 P2558R2 - Add @, $, and ` to the basic character set
+// { dg-do compile { target c++26 } }
+
+const char *s0 = R"`@$$@`@`$()`@$$@`@`$";
--- gcc/testsuite/g++.dg/cpp26/raw-string2.C.jj	2024-07-17 20:54:53.478273235 +0200
+++ gcc/testsuite/g++.dg/cpp26/raw-string2.C	2024-07-17 20:58:46.177289931 +0200
@@ -0,0 +1,7 @@
+// C++26 P2558R2 - Add @, $, and ` to the basic character set
+// { dg-do compile { target { ! { avr*-*-* mmix*-*-* *-*-aix* } } } }
+// { dg-options "" }
+
+int a$b;
+int a\u0024c;		// { dg-error "universal character \\\\u0024 is not valid in an identifier" "" { target c++26 } }
+int a\U00000024d;	// { dg-error "universal character \\\\U00000024 is not valid in an identifier" "" { target c++26 } }
