On 03/01/20 22:04 +0100, François Dumont wrote:
This is the patch to extend PR 92124 to the associative containers.

As it is pretty simple I thought it could maybe go in now.

I also think that the existing 92124 tests are not really testing what they should with the move assignment operators noexcept qualified, no ?

    PR libstdc++/92124
    * include/bits/stl_tree.h
    (_Rb_tree<>::_M_move_assign(_Rb_tree&, false_type)): Replace
    std::move_if_noexcept by std::move.
    * testsuite/23_containers/deque/92124.cc
    (X::operator==(X&&)): Qualify noexcept(false).
    * testsuite/23_containers/forward_list/92124.cc: Likewise.
    * testsuite/23_containers/list/92124.cc: Likewise.
    * testsuite/23_containers/vector/92124.cc: Likewise.
    * testsuite/23_containers/map/92124.cc: New.
    * testsuite/23_containers/set/92124.cc: New.

Tested under linux x86_64.

François


diff --git a/libstdc++-v3/include/bits/stl_tree.h 
b/libstdc++-v3/include/bits/stl_tree.h
index 12ba3181dd9..9339011e872 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -1695,7 +1695,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
            [&__roan](const value_type& __cval)
            {
              auto& __val = const_cast<value_type&>(__cval);
-             return __roan(std::move_if_noexcept(__val));
+             return __roan(std::move(__val));

This part is OK and so is the new test.

            };
          _M_root() = _M_copy(__x, __lbd);
          __x.clear();
diff --git a/libstdc++-v3/testsuite/23_containers/deque/92124.cc 
b/libstdc++-v3/testsuite/23_containers/deque/92124.cc
index 0bdfcb70dcf..ea16d415a49 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/92124.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/92124.cc
@@ -30,7 +30,7 @@ struct X {
    // Tracking calls to assignment functions
    X& operator=(const X&) { throw 1; }

-    X& operator=(X&&) noexcept(true) { return *this; }
+    X& operator=(X&&) noexcept(false) { return *this; }

These changes don't seem to be needed. Is there a reason to change it?

Reply via email to