From e2ce9436fbb0a61a6a96fa39fb8439bc5f0a626c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Fri, 25 Apr 2014 19:34:42 +0000 Subject: [PATCH] re PR libstdc++/60710 (experimental::optional is using T::operator!=) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2014-04-25 Lars Gullik Bjønnes PR libstdc++/60710 * include/experimental/optional (operator!=): Implement in terms of operator==. * testsuite/experimental/optional/relops/1.cc: Remove operator!=. * testsuite/experimental/optional/relops/2.cc: Likewise. * testsuite/experimental/optional/relops/3.cc: Likewise. * testsuite/experimental/optional/relops/4.cc: Likewise. * testsuite/experimental/optional/relops/5.cc: Likewise. * testsuite/experimental/optional/relops/6.cc: Likewise. From-SVN: r209810 --- libstdc++-v3/ChangeLog | 12 ++++++++++++ libstdc++-v3/include/experimental/optional | 4 ++-- .../testsuite/experimental/optional/relops/1.cc | 4 ---- .../testsuite/experimental/optional/relops/2.cc | 4 ---- .../testsuite/experimental/optional/relops/3.cc | 4 ---- .../testsuite/experimental/optional/relops/4.cc | 4 ---- .../testsuite/experimental/optional/relops/5.cc | 4 ---- .../testsuite/experimental/optional/relops/6.cc | 4 ---- 8 files changed, 14 insertions(+), 26 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index eace534a30b..2a2c0686195 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2014-04-25 Lars Gullik Bjønnes + + PR libstdc++/60710 + * include/experimental/optional (operator!=): Implement in terms of + operator==. + * testsuite/experimental/optional/relops/1.cc: Remove operator!=. + * testsuite/experimental/optional/relops/2.cc: Likewise. + * testsuite/experimental/optional/relops/3.cc: Likewise. + * testsuite/experimental/optional/relops/4.cc: Likewise. + * testsuite/experimental/optional/relops/5.cc: Likewise. + * testsuite/experimental/optional/relops/6.cc: Likewise. + 2014-04-25 Jonathan Wakely PR libstdc++/60958 diff --git a/libstdc++-v3/include/experimental/optional b/libstdc++-v3/include/experimental/optional index 5f2d93fb7f6..2a3f29dcd70 100644 --- a/libstdc++-v3/include/experimental/optional +++ b/libstdc++-v3/include/experimental/optional @@ -736,12 +736,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template constexpr bool operator!=(const optional<_Tp>& __lhs, _Tp const& __rhs) - { return !__lhs || *__lhs != __rhs; } + { return !__lhs || !(*__lhs == __rhs); } template constexpr bool operator!=(const _Tp& __lhs, const optional<_Tp>& __rhs) - { return !__rhs || __lhs != *__rhs; } + { return !__rhs || !(__lhs == *__rhs); } template constexpr bool diff --git a/libstdc++-v3/testsuite/experimental/optional/relops/1.cc b/libstdc++-v3/testsuite/experimental/optional/relops/1.cc index f1408805ac2..3f1ee9c4900 100644 --- a/libstdc++-v3/testsuite/experimental/optional/relops/1.cc +++ b/libstdc++-v3/testsuite/experimental/optional/relops/1.cc @@ -36,10 +36,6 @@ namespace ns operator==(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) == std::tie(rhs.i, rhs.s); } - bool - operator!=(value_type const& lhs, value_type const& rhs) - { return !(lhs == rhs); } - bool operator<(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) < std::tie(rhs.i, rhs.s); } diff --git a/libstdc++-v3/testsuite/experimental/optional/relops/2.cc b/libstdc++-v3/testsuite/experimental/optional/relops/2.cc index c7fc848deb0..6ee9cba768a 100644 --- a/libstdc++-v3/testsuite/experimental/optional/relops/2.cc +++ b/libstdc++-v3/testsuite/experimental/optional/relops/2.cc @@ -36,10 +36,6 @@ namespace ns operator==(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) == std::tie(rhs.i, rhs.s); } - bool - operator!=(value_type const& lhs, value_type const& rhs) - { return !(lhs == rhs); } - bool operator<(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) < std::tie(rhs.i, rhs.s); } diff --git a/libstdc++-v3/testsuite/experimental/optional/relops/3.cc b/libstdc++-v3/testsuite/experimental/optional/relops/3.cc index 9729000d5ca..581d0168fbc 100644 --- a/libstdc++-v3/testsuite/experimental/optional/relops/3.cc +++ b/libstdc++-v3/testsuite/experimental/optional/relops/3.cc @@ -36,10 +36,6 @@ namespace ns operator==(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) == std::tie(rhs.i, rhs.s); } - bool - operator!=(value_type const& lhs, value_type const& rhs) - { return !(lhs == rhs); } - bool operator<(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) < std::tie(rhs.i, rhs.s); } diff --git a/libstdc++-v3/testsuite/experimental/optional/relops/4.cc b/libstdc++-v3/testsuite/experimental/optional/relops/4.cc index 45378f688e4..ce16fcb92f5 100644 --- a/libstdc++-v3/testsuite/experimental/optional/relops/4.cc +++ b/libstdc++-v3/testsuite/experimental/optional/relops/4.cc @@ -36,10 +36,6 @@ namespace ns operator==(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) == std::tie(rhs.i, rhs.s); } - bool - operator!=(value_type const& lhs, value_type const& rhs) - { return !(lhs == rhs); } - bool operator<(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) < std::tie(rhs.i, rhs.s); } diff --git a/libstdc++-v3/testsuite/experimental/optional/relops/5.cc b/libstdc++-v3/testsuite/experimental/optional/relops/5.cc index 008409ef402..c01bba57a5e 100644 --- a/libstdc++-v3/testsuite/experimental/optional/relops/5.cc +++ b/libstdc++-v3/testsuite/experimental/optional/relops/5.cc @@ -36,10 +36,6 @@ namespace ns operator==(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) == std::tie(rhs.i, rhs.s); } - bool - operator!=(value_type const& lhs, value_type const& rhs) - { return !(lhs == rhs); } - bool operator<(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) < std::tie(rhs.i, rhs.s); } diff --git a/libstdc++-v3/testsuite/experimental/optional/relops/6.cc b/libstdc++-v3/testsuite/experimental/optional/relops/6.cc index b17914062ee..a24622b5f40 100644 --- a/libstdc++-v3/testsuite/experimental/optional/relops/6.cc +++ b/libstdc++-v3/testsuite/experimental/optional/relops/6.cc @@ -36,10 +36,6 @@ namespace ns operator==(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) == std::tie(rhs.i, rhs.s); } - bool - operator!=(value_type const& lhs, value_type const& rhs) - { return !(lhs == rhs); } - bool operator<(value_type const& lhs, value_type const& rhs) { return std::tie(lhs.i, lhs.s) < std::tie(rhs.i, rhs.s); } -- 2.30.2