[PATCH] libstdc++: fix build failures after acfdad706d8

Nathan Myers ncm@cantrip.org
Wed May 20 07:11:04 GMT 2026


Done. The 2nd Changelog entry as committed is

   * include/bits/basic_string.tcc (reserve): Guard __limit decl
   under #if __cpp_exceptions to quiet warning


On 5/20/26 2:56 AM, Jonathan Wakely wrote:
> 
> 
> On Wed, 20 May 2026, 01:06 Nathan Myers, <ncm@cantrip.org 
> <mailto:ncm@cantrip.org>> wrote:
> 
>     Patch build failures from 2026-05-19 09:33:58
> 
>     libstdc++-v3/Changelog:
>              * config/abi/pre/gnu.ver: Remove recent symbol swept up in
>              GLIBCXX_3.4.21.
>              * include/bits/basic_string.tcc (reserve): Guard __limit decl
>              under #ifdef __glibcxx_allocate_at_least to quiet warning.
> 
> 
> 
> It was already guarded under that macro, shouldn't this be __cpp_exceptions?
> 
> OK either way, since this needs to be fixed.
> 
> 
>     ---
>       libstdc++-v3/config/abi/pre/gnu.ver        |  2 +-
>       libstdc++-v3/include/bits/basic_string.tcc | 14 ++++++++------
>       2 files changed, 9 insertions(+), 7 deletions(-)
> 
>     diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/
>     config/abi/pre/gnu.ver
>     index bf4d7338cb6..3a6afac8308 100644
>     --- a/libstdc++-v3/config/abi/pre/gnu.ver
>     +++ b/libstdc++-v3/config/abi/pre/gnu.ver
>     @@ -1775,7 +1775,7 @@ GLIBCXX_3.4.21 {
>         
>       _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE12_M_constructI[NP]*;
>           _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE13*;
>         
>       _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE14_M_replace_aux*;
>     -   
>     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[68-9]*;
>     +   
>     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[68]*;
>         
>       _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE2at*;
>         
>       _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE3end*;
>         
>       _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE4back*;
>     diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-
>     v3/include/bits/basic_string.tcc
>     index 5f83991db83..64c99fbb9d6 100644
>     --- a/libstdc++-v3/include/bits/basic_string.tcc
>     +++ b/libstdc++-v3/include/bits/basic_string.tcc
>     @@ -433,11 +433,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>             if (_M_is_local())
>              return;
> 
>     -#ifdef __glibcxx_allocate_at_least  // C++23
>     -      const size_type __limit = (__STDCPP_DEFAULT_NEW_ALIGNMENT__ -
>     1) / sizeof(_CharT);
>     -#else
>     -      const size_type __limit = 0;
>     -#endif
>             const size_type __length = length();
>             const size_type __capacity = _M_allocated_capacity;
> 
>     @@ -447,9 +442,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>                this->_S_copy(_M_local_buf, _M_data(), __length + 1);
>                _M_destroy(__capacity);
>                _M_data(_M_local_data());
>     +         return;
>              }
>       #if __cpp_exceptions
>     -      else if (__capacity - __length > __limit )
>     +#ifdef __glibcxx_allocate_at_least  // C++23
>     +      const size_type __limit =
>     +       (__STDCPP_DEFAULT_NEW_ALIGNMENT__ - 1) / sizeof(_CharT);
>     +#else
>     +      const size_type __limit = 0;
>     +#endif
>     +      if (__capacity - __length > __limit )
>              try
>                {
>                  _Alloc_result __r = _S_allocate_at_least(
>     -- 
>     2.54.0
> 



More information about the Libstdc++ mailing list