[libc++] Fix use of std::errc() for C++ < 11 (#138522)

After 8fc2538f33 "Reapply '[libc++]
Optimize num_put integral functions' (#131613) (#133572)", including
<locale> in C++03 mode with Debug hardening enabled fails.

This patch fixes that by applying a workaround used elsewhere to
construct errc in C++03 mode.
This commit is contained in:
Stephan Bergmann
2025-05-12 21:55:24 +02:00
committed by GitHub
parent 8d7b35eeff
commit b233c5fbe0

View File

@@ -1277,7 +1277,7 @@ _LIBCPP_HIDE_FROM_ABI inline _OutputIterator num_put<_CharT, _OutputIterator>::_
}
auto __res = std::__to_chars_integral(__buffer_ptr, __char_buffer + __buffer_size, __uval, __base);
_LIBCPP_ASSERT_INTERNAL(__res.__ec == std::errc(), "to_chars: invalid maximum buffer size computed?");
_LIBCPP_ASSERT_INTERNAL(__res.__ec == std::errc(0), "to_chars: invalid maximum buffer size computed?");
// Make letters uppercase
if (__flags & ios_base::hex && __flags & ios_base::uppercase) {