]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix check for 7-bit ASCII characters
authorJonathan Wakely <jwakely@redhat.com>
Fri, 10 Oct 2025 22:16:22 +0000 (23:16 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 13 Oct 2025 10:03:44 +0000 (11:03 +0100)
This should check for c <= 0x7f not x < 0x7f, because 0x7f is an ASCII
character (DEL).

libstdc++-v3/ChangeLog:

* include/bits/unicode.h (__is_single_code_unit): Fix check for
7-bit ASCII characters.

Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
libstdc++-v3/include/bits/unicode.h

index 88e97d41a9eb03cc0fb9129938c527e5f8ab3fa1..00efbe89ca8e117a8a943734760dd95abd4c8200 100644 (file)
@@ -61,7 +61,7 @@ namespace __unicode
     __is_single_code_unit(char32_t __c)
     {
       if constexpr (__gnu_cxx::__int_traits<_CharT>::__max <= 0xFF)
-       return __c < 0x7F; // ASCII character
+       return __c <= 0x7F; // ASCII character
       else
        return __c < __gnu_cxx::__int_traits<_CharT>::__max
                       && __is_scalar_value(__c);