https://gcc.gnu.org/g:692c4cad4662c7672d05f8cad7fc075db20f53a0

commit r17-1623-g692c4cad4662c7672d05f8cad7fc075db20f53a0
Author: Marek Polacek <[email protected]>
Date:   Fri Jun 5 17:25:36 2026 -0400

    libstdc++: adjust explicit inst of std::basic_string::data()
    
    r15-2650 removed noexcept from non-const std::basic_string::data()
    in bits/cow_string.h, but the explicit instantiations in string-inst.cc
    kept their noexcept.  [except.spec] says that in an explicit instantiation
    a noexcept-specifier may be specified, but is not required, but when it
    is specified, it must be the same as the exception specification of all
    other declarations of that function.  So I think we should just remove it.
    
    libstdc++-v3/ChangeLog:
    
            * src/c++17/string-inst.cc (basic_string::data): Remove noexcept.
    
    Reviewed-by: Patrick Palka <[email protected]>
    Reviewed-by: Jonathan Wakely <[email protected]>

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

diff --git a/libstdc++-v3/src/c++17/string-inst.cc 
b/libstdc++-v3/src/c++17/string-inst.cc
index ac52adaa7b5e..e9ef1bfd0dcc 100644
--- a/libstdc++-v3/src/c++17/string-inst.cc
+++ b/libstdc++-v3/src/c++17/string-inst.cc
@@ -42,14 +42,14 @@ template basic_string<char>::basic_string(__sv_wrapper, 
const allocator_type&);
 template basic_string<char>::__sv_wrapper::__sv_wrapper(string_view);
 template string_view basic_string<char>::_S_to_string_view(string_view);
 template basic_string<char>::operator string_view() const noexcept;
-template char* basic_string<char>::data() noexcept;
+template char* basic_string<char>::data();
 
 #ifdef _GLIBCXX_USE_WCHAR_T
 template basic_string<wchar_t>::basic_string(__sv_wrapper, const 
allocator_type&);
 template basic_string<wchar_t>::__sv_wrapper::__sv_wrapper(wstring_view);
 template wstring_view basic_string<wchar_t>::_S_to_string_view(wstring_view);
 template basic_string<wchar_t>::operator wstring_view() const noexcept;
-template wchar_t* basic_string<wchar_t>::data() noexcept;
+template wchar_t* basic_string<wchar_t>::data();
 #endif
 
 _GLIBCXX_END_NAMESPACE_VERSION

Reply via email to