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.
---
Tested x86_64-linux.
There's no new test for this as I couldn't get std::format to produce
wrong results with e.g. DEL as a fill character. It gives the right
result, just using a slower path that converts the fill character to
UTF-32 and then constructs a basic_string from _Utf32_view. With the
fix, we avoid that slow path.
libstdc++-v3/include/bits/unicode.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libstdc++-v3/include/bits/unicode.h
b/libstdc++-v3/include/bits/unicode.h
index 88e97d41a9eb..00efbe89ca8e 100644
--- a/libstdc++-v3/include/bits/unicode.h
+++ b/libstdc++-v3/include/bits/unicode.h
@@ -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);
--
2.51.0