]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Add conditional noexcept to std::pair default ctor
authorJonathan Wakely <jwakely@redhat.com>
Tue, 18 Jun 2024 19:57:24 +0000 (20:57 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 19 Jun 2024 16:34:18 +0000 (17:34 +0100)
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

index 0c1e5719a1a3b11beb66398e0656cfce06e794e0..0d60eaba1941e12e4f4b1aa8c5c068c9cec72a5d 100644 (file)
@@ -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()