[gcc r17-2661] libstdc++: Remove noexcept from basic_string instantiations [PR126327]

Jonathan Wakely redi@gcc.gnu.org
Thu Jul 23 10:52:51 GMT 2026


https://gcc.gnu.org/g:4e2b29c333fcbead93b2911326cff4218d3c155c

commit r17-2661-g4e2b29c333fcbead93b2911326cff4218d3c155c
Author: Nathan Blackburn <nathan.blackburn@arm.com>
Date:   Wed Jul 22 16:48:38 2026 +0000

    libstdc++: Remove noexcept from basic_string instantiations [PR126327]
    
    The explicit instantiations of basic_string's default constructor used
    an unconditional noexcept specification. For the fully-dynamic COW
    string, those default constructors are noexcept(false).
    
    Remove noexcept from both the char and wchar_t instantiations.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/126327
            * src/c++20/string-inst.cc (basic_string::basic_string): Remove
            noexcept.

Diff:
---
 libstdc++-v3/src/c++20/string-inst.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/src/c++20/string-inst.cc b/libstdc++-v3/src/c++20/string-inst.cc
index 2bdd77c78a4f..b6b8d295b7cf 100644
--- a/libstdc++-v3/src/c++20/string-inst.cc
+++ b/libstdc++-v3/src/c++20/string-inst.cc
@@ -37,7 +37,7 @@
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
-template basic_string<char>::basic_string() noexcept;
+template basic_string<char>::basic_string();
 template bool basic_string<char>::starts_with(string_view) const noexcept;
 template bool basic_string<char>::starts_with(char) const noexcept;
 template bool basic_string<char>::starts_with(const char*) const noexcept;
@@ -46,7 +46,7 @@ template bool basic_string<char>::ends_with(char) const noexcept;
 template bool basic_string<char>::ends_with(const char*) const noexcept;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-template basic_string<wchar_t>::basic_string() noexcept;
+template basic_string<wchar_t>::basic_string();
 template bool basic_string<wchar_t>::starts_with(wstring_view) const noexcept;
 template bool basic_string<wchar_t>::starts_with(wchar_t) const noexcept;
 template bool basic_string<wchar_t>::starts_with(const wchar_t*) const noexcept;


More information about the Libstdc++-cvs mailing list