libstdc++: Fix check for 7-bit ASCII characters

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>
This commit is contained in:
Jonathan Wakely 2025-10-10 23:16:22 +01:00 committed by Jonathan Wakely
parent 85ab3a22ed
commit fc74f4f0a2
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View 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);