summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/experimental
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-06-08 14:56:57 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-06-08 15:01:06 +0100
commitd319517e809ee50496db29e552f86a83a14c837c (patch)
treeeb7f646279de62312995493d391e8fc95b82c621 /libstdc++-v3/include/experimental
parent7a56d3d3e99cc77ad8a6a674870c814da6225675 (diff)
libstdc++: Finish implementing LWG 3413 for propagate_const
We already have conditional noexcept so this just constrains the non-member swap overload. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/experimental/propagate_const (swap): Constrain. * testsuite/experimental/propagate_const/swap/lwg3413.cc: New test.
Diffstat (limited to 'libstdc++-v3/include/experimental')
-rw-r--r--libstdc++-v3/include/experimental/propagate_const8
1 files changed, 7 insertions, 1 deletions
diff --git a/libstdc++-v3/include/experimental/propagate_const b/libstdc++-v3/include/experimental/propagate_const
index 0d03c13c5e1..162b4783dd7 100644
--- a/libstdc++-v3/include/experimental/propagate_const
+++ b/libstdc++-v3/include/experimental/propagate_const
@@ -113,6 +113,7 @@ inline namespace fundamentals_v2
constexpr propagate_const() = default;
propagate_const(const propagate_const& __p) = delete;
constexpr propagate_const(propagate_const&& __p) = default;
+
template <typename _Up, typename
enable_if<__and_<is_constructible<_Tp, _Up&&>,
is_convertible<_Up&&, _Tp>>::value, bool
@@ -120,6 +121,7 @@ inline namespace fundamentals_v2
constexpr propagate_const(propagate_const<_Up>&& __pu)
: _M_t(std::move(get_underlying(__pu)))
{}
+
template <typename _Up, typename
enable_if<__and_<is_constructible<_Tp, _Up&&>,
__not_<is_convertible<_Up&&, _Tp>>>::value,
@@ -127,6 +129,7 @@ inline namespace fundamentals_v2
constexpr explicit propagate_const(propagate_const<_Up>&& __pu)
: _M_t(std::move(get_underlying(__pu)))
{}
+
template <typename _Up, typename
enable_if<__and_<is_constructible<_Tp, _Up&&>,
is_convertible<_Up&&, _Tp>,
@@ -136,6 +139,7 @@ inline namespace fundamentals_v2
constexpr propagate_const(_Up&& __u)
: _M_t(std::forward<_Up>(__u))
{}
+
template <typename _Up, typename
enable_if<__and_<is_constructible<_Tp, _Up&&>,
__not_<is_convertible<_Up&&, _Tp>>,
@@ -399,8 +403,10 @@ inline namespace fundamentals_v2
}
// [propagate_const.algorithms], specialized algorithms
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 3413. propagate_const's swap [...] needs to be constrained and use a trait
template <typename _Tp>
- constexpr void
+ constexpr enable_if_t<__is_swappable<_Tp>::value, void>
swap(propagate_const<_Tp>& __pt, propagate_const<_Tp>& __pt2)
noexcept(__is_nothrow_swappable<_Tp>::value)
{