LWG2593 Move from allocator state is preserved

François Dumont frs.dumont@gmail.com
Fri May 17 04:57:00 GMT 2019


2 other tests needed to be adapted in 21_strings. Attached patch applied.

2019-05-17  François Dumont <fdumont@gcc.gnu.org>

     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.
     * testsuite/21_strings/basic_string/allocator/char/move_assign.cc
     (test02): Adapt.
     * testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc
     (test02): Adapt.


On 5/16/19 11:05 AM, Jonathan Wakely wrote:
> 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.
>
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lwg2593.patch
Type: text/x-patch
Size: 14247 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20190517/1730380b/attachment.bin>


More information about the Libstdc++ mailing list