LWG2593 Move from allocator state is preserved

Jonathan Wakely jwakely@redhat.com
Thu May 16 09:05:00 GMT 2019


On 16/05/19 07:48 +0200, François Dumont wrote:
>Hi
>
>    Let's apply this resolution first before moving forward with the 
>std::deque implementation.
>
>    Move from state of allocators (LWG2593)
>    * include/bits/stl_deque.h
>    (_Deque_base(_Deque_base&&, false_type)): Remove.
>    (_Deque_base(_Deque_base&&, true_type)): Remove.
>    (_Deque_base(_Deque_base&&)): Adapt.
>    (_Deque_base::_M_move_impl()): Remove.
>    * testsuite/util/testsuite_allocator.h
>    (propagating_allocator(propagating_allocator&&)): Preserve move from
>    state.
>    * testsuite/23_containers/deque/allocator/move_assign.cc (test02):
>    Adapt.
>    * testsuite/23_containers/forward_list/allocator/move_assign.cc 
>(test02):
>    Adapt.
>    * testsuite/23_containers/list/allocator/move_assign.cc (test02): 
>Adapt.
>    * testsuite/23_containers/map/allocator/move_assign.cc (test02): Adapt.
>    * testsuite/23_containers/multimap/allocator/move_assign.cc (test02):
>    Adapt.
>    * testsuite/23_containers/multiset/allocator/move_assign.cc (test02):
>    Adapt.
>    * testsuite/23_containers/set/allocator/move_assign.cc (test02): Adapt.
>    * testsuite/23_containers/unordered_map/allocator/move_assign.cc
>    (test02): Adapt.
>    * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc
>    (test02): Adapt.
>    * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc
>    (test02): Adapt.
>    * testsuite/23_containers/unordered_set/allocator/move_assign.cc
>    (test02): Adapt.
>    * testsuite/23_containers/vector/allocator/move_assign.cc (test02):
>    Adapt.
>    * testsuite/23_containers/vector/bool/allocator/move_assign.cc 
>(test02):
>    Adapt.
>
>I only run 23_containers tests with success so far, I'll complete the 
>run before committing.

Nice, thanks for doing this.

>Ok to commit ?
 
Yes, although I'd like one change ...

>diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h
>index d817ac4e838..a98869ed14f 100644
>--- a/libstdc++-v3/testsuite/util/testsuite_allocator.h
>+++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h
>@@ -465,12 +465,12 @@ namespace __gnu_test
> 	  return *this;
>   	}
> 
>-      // postcondition: a.get_personality() == 0
>+      // postcondition: LWG2593 a.get_personality() un-changed.
>       propagating_allocator(propagating_allocator&& a) noexcept
>-      : base_alloc()
>-      { swap_base(a); }
>+      : base_alloc(std::move(a.base()))
>+      { /*swap_base(a);*/ }

I don't think we should keep the /*swap_base(a);*/ comment. It just
confusing to have commented-out code that implements an old
behaviour.

OK for trunk with that /*...*/ comment removed.

Thanks again.




More information about the Libstdc++ mailing list