[libcxx-commits] [libcxx] [libc++] Introduce basic_string::__allocate_long_buffer_for_growing (PR #162633)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 9 02:59:10 PDT 2026


================
@@ -2714,14 +2727,10 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
     size_type __n_del,
     size_type __n_add,
     const value_type* __p_new_stuff) {
-  size_type __ms = max_size();
-  if (__delta_cap > __ms - __old_cap)
-    __throw_length_error();
+  __long __buffer = __allocate_long_buffer(__alloc_, __get_amortized_growth_capacity(__old_cap + __delta_cap));
----------------
philnik777 wrote:

Do you have a minimal reproducer?

https://github.com/llvm/llvm-project/pull/162633


More information about the libcxx-commits mailing list