aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Voutilainen <ville.voutilainen@gmail.com>2016-10-20 14:54:52 +0300
committerVille Voutilainen <ville@gcc.gnu.org>2016-10-20 14:54:52 +0300
commitf320e6a09193654596cd347fae835e85b458f94c (patch)
treee918f7173f1a80275990376780df8b568e73df2c
parent88b3e631506a51e5e1ae04224efe0b5ac5f7d0ca (diff)
downloadgcc-f320e6a09193654596cd347fae835e85b458f94c.zip
gcc-f320e6a09193654596cd347fae835e85b458f94c.tar.gz
gcc-f320e6a09193654596cd347fae835e85b458f94c.tar.bz2
Do the operator= SFINAE in the return type for optional,
not in the template parameters. * include/std/optional (operator=(_Up&&)): Move SFINAE from template parameters to the return type. (operator=(const optional<_Up>&)): Likewise. (operator=(optional<_Up>&&)): Likewise. From-SVN: r241372
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/include/std/optional55
2 files changed, 35 insertions, 29 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f0360c5..378e9fa 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,12 @@
+2016-10-20 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Do the operator= SFINAE in the return type for optional,
+ not in the template parameters.
+ * include/std/optional (operator=(_Up&&)): Move SFINAE
+ from template parameters to the return type.
+ (operator=(const optional<_Up>&)): Likewise.
+ (operator=(optional<_Up>&&)): Likewise.
+
2016-10-20 Jonathan Wakely <jwakely@redhat.com>
* include/bits/allocator.h: Remove trailing whitespace, tab-indent.
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index 21210ab..f272876 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -568,15 +568,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return *this;
}
- template<typename _Up = _Tp,
- enable_if_t<__and_<
- __not_<is_same<optional<_Tp>, decay_t<_Up>>>,
- is_constructible<_Tp, _Up>,
- __not_<__and_<is_scalar<_Tp>,
- is_same<_Tp, decay_t<_Up>>>>,
- is_assignable<_Tp&, _Up>>::value,
- bool> = true>
- optional&
+ template<typename _Up = _Tp>
+ enable_if_t<__and_<
+ __not_<is_same<optional<_Tp>, decay_t<_Up>>>,
+ is_constructible<_Tp, _Up>,
+ __not_<__and_<is_scalar<_Tp>,
+ is_same<_Tp, decay_t<_Up>>>>,
+ is_assignable<_Tp&, _Up>>::value,
+ optional&>
operator=(_Up&& __u)
{
if (this->_M_is_engaged())
@@ -587,16 +586,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return *this;
}
- template<typename _Up,
- enable_if_t<__and_<
- __not_<is_same<_Tp, _Up>>,
- is_constructible<_Tp, const _Up&>,
- is_assignable<_Tp&, _Up>,
- __not_<__converts_from_optional<_Tp, _Up>>,
- __not_<__assigns_from_optional<_Tp, _Up>>
- >::value,
- bool> = true>
- optional&
+ template<typename _Up>
+ enable_if_t<__and_<
+ __not_<is_same<_Tp, _Up>>,
+ is_constructible<_Tp, const _Up&>,
+ is_assignable<_Tp&, _Up>,
+ __not_<__converts_from_optional<_Tp, _Up>>,
+ __not_<__assigns_from_optional<_Tp, _Up>>
+ >::value,
+ optional&>
operator=(const optional<_Up>& __u)
{
if (__u)
@@ -613,16 +611,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return *this;
}
- template<typename _Up,
- enable_if_t<__and_<
- __not_<is_same<_Tp, _Up>>,
- is_constructible<_Tp, _Up>,
- is_assignable<_Tp&, _Up>,
- __not_<__converts_from_optional<_Tp, _Up>>,
- __not_<__assigns_from_optional<_Tp, _Up>>
- >::value,
- bool> = true>
- optional&
+ template<typename _Up>
+ enable_if_t<__and_<
+ __not_<is_same<_Tp, _Up>>,
+ is_constructible<_Tp, _Up>,
+ is_assignable<_Tp&, _Up>,
+ __not_<__converts_from_optional<_Tp, _Up>>,
+ __not_<__assigns_from_optional<_Tp, _Up>>
+ >::value,
+ optional&>
operator=(optional<_Up>&& __u)
{
if (__u)