[libcxx-commits] [libcxx] [libc++] Make basic_string::__erase_external_with_move noexcept (PR #171591)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 10 02:17:21 PST 2025


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/171591

None

>From 775f69933a0bf62c47ed0a9af62381a3b1eab310 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 10 Dec 2025 11:17:03 +0100
Subject: [PATCH] [libc++] Make basic_string::__erase_external_with_move
 noexcept

---
 libcxx/include/string | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libcxx/include/string b/libcxx/include/string
index 2b3ba6d2d9b62..b1f1b30237d86 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -2463,7 +2463,8 @@ private:
 
   // __erase_external_with_move is invoked for erase() invocations where
   // `n ~= npos`, likely requiring memory moves on the string data.
-  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __erase_external_with_move(size_type __pos, size_type __n);
+  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
+  __erase_external_with_move(size_type __pos, size_type __n) _NOEXCEPT;
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const basic_string& __str) {
     __copy_assign_alloc(
@@ -3329,7 +3330,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
 // Does not check __pos against size()
 template <class _CharT, class _Traits, class _Allocator>
 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
-basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type __pos, size_type __n) {
+basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type __pos, size_type __n) _NOEXCEPT {
   if (__n == 0)
     return;
 



More information about the libcxx-commits mailing list