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

via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 12 12:55:27 PDT 2025


Author: Stephan Bergmann
Date: 2025-05-12T15:55:24-04:00
New Revision: b233c5fbe0af0daab426e8c9b1949c45d04749a5

URL: https://github.com/llvm/llvm-project/commit/b233c5fbe0af0daab426e8c9b1949c45d04749a5
DIFF: https://github.com/llvm/llvm-project/commit/b233c5fbe0af0daab426e8c9b1949c45d04749a5.diff

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

After 8fc2538f338088bd084d217a7569d72c3b630e8c "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.

Added: 
    

Modified: 
    libcxx/include/locale

Removed: 
    


################################################################################
diff  --git a/libcxx/include/locale b/libcxx/include/locale
index fa2620d883598..b206bf8f162f9 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -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) {


        


More information about the libcxx-commits mailing list