https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123918

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Untested fix:

2026-02-02  Jakub Jelinek  <[email protected]>

        PR c++/123918
        * semantics.cc (cexpr_str::extract): Bypass cpp_translate_string
        for len == 0.

--- gcc/cp/semantics.cc.jj      2026-01-28 19:17:49.532306466 +0100
+++ gcc/cp/semantics.cc 2026-02-02 10:52:20.787120028 +0100
@@ -12860,7 +12860,10 @@ cexpr_str::extract (location_t location,
       cpp_string istr, ostr;
       istr.len = len;
       istr.text = (const unsigned char *) msg;
-      if (!cpp_translate_string (parse_in, &istr, &ostr, CPP_STRING, true))
+      if (len == 0)
+       ;
+      else if (!cpp_translate_string (parse_in, &istr, &ostr, CPP_STRING,
+                                     true))
        {
          error_at (location, "could not convert constexpr string from "
                              "ordinary literal encoding to source character "

Reply via email to