[PATCH] libstdc++: Remove noexcept from basic_string instantiations
Marek Polacek
polacek@redhat.com
Wed Jul 22 16:52:31 GMT 2026
CCing libstdc++.
On Wed, Jul 22, 2026 at 04:48:38PM +0000, Nathan Blackburn wrote:
> The explicit instantiations of basic_string's default constructor used
> an unconditional noexcept specification.
>
> Remove noexcept from both the char and wchar_t instantiations.
>
> This bug has been repoted in GCC Bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126327
Can't approve this, but it looks OK to me.
> libstdc++-v3/ChangeLog:
>
> * src/c++20/string-inst.cc (basic_string::basic_string): Remove
> noexcept.
The second line may be wrongly indented here.
> ---
> 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 2bdd77c78a4..b6b8d295b7c 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;
> --
> 2.47.3
>
Marek
More information about the Libstdc++
mailing list