[committed] libstdc++: Add conditional noexcept to std::pair default ctor

Message ID 20240619163547.1791344-1-jwakely@redhat.com
State Committed
Commit 9651d6005f9c1ac60aecf7b36d6c0bd1ead8a63b
Headers
Series [committed] libstdc++: Add conditional noexcept to std::pair default ctor |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 warning Patch is already merged

Commit Message

Jonathan Wakely June 19, 2024, 4:35 p.m. UTC
  Tested x86_64-linux. Pushed to trunk.

-- >8 --

Most of std::pair constructors implemented using C++20 concepts have a
conditional noexcept-specifier, but the default constructor doesn't.
This fixes that.

libstdc++-v3/ChangeLog:

	* include/bits/stl_pair.h [__cpp_lib_concepts] (pair()): Add
	conditional noexcept.
---
 libstdc++-v3/include/bits/stl_pair.h | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 0c1e5719a1a..0d60eaba194 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -344,6 +344,8 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       explicit(__not_<__and_<__is_implicitly_default_constructible<_T1>,
 			     __is_implicitly_default_constructible<_T2>>>())
       pair()
+      noexcept(is_nothrow_default_constructible_v<_T1>
+		&& is_nothrow_default_constructible_v<_T2>)
       requires is_default_constructible_v<_T1>
 	       && is_default_constructible_v<_T2>
       : first(), second()