Relocation (= move+destroy)

Marc Glisse marc.glisse@inria.fr
Sat Oct 13 09:07:00 GMT 2018


On Sun, 2 Sep 2018, Jonathan Wakely wrote:

> On 01/09/18 21:56 +0200, Marc Glisse wrote:
>> On Sat, 1 Sep 2018, Marc Glisse wrote:
>> 
>>> this patch passed bootstrap+regtest on powerpc64le-unknown-linux-gnu.
>> 
>> I realized afterwards that for a C++17-only feature, that's not testing 
>> much... So I changed it to apply in C++14 and fixed a minor issue. There is 
>> now a single regression:
>> 
>> 23_containers/vector/modifiers/push_back/49836.cc
>> 
>> The PR was about not using assignment for an operation that should only use 
>> construction, and that's fine. But we ended up with a stricter testcase 
>> using CopyConsOnlyType, where the type has a deleted move constructor 
>> which, as far as I understand the standard, makes it an invalid type for 
>> use in vector::push_back. Is that something we want to keep supporting, or 
>> may I break it? What is happening is that 
>
> I think you can break it. I'll look back over the history of the test
> case, but I don't think supporting deleted moves is intended.

Here is a version where I adapt the test. Bootstrap+testsuite on gcc112.

2018-10-15  Marc Glisse  <marc.glisse@inria.fr>

 	PR libstdc++/87106
 	* include/bits/alloc_traits.h (_S_construct, _S_destroy, construct,
 	destroy): Add noexcept specification.
 	* include/bits/allocator.h (construct, destroy): Likewise.
 	* include/ext/alloc_traits.h (construct, destroy): Likewise.
 	* include/ext/malloc_allocator.h (construct, destroy): Likewise.
 	* include/ext/new_allocator.h (construct, destroy): Likewise.
 	* include/bits/stl_uninitialized.h (__relocate, __relocate_a,
 	__relocate_a_1): New functions.
 	(__is_trivially_relocatable): New class.
 	* include/bits/stl_vector.h (__use_relocate): New static member.
 	* include/bits/vector.tcc (reserve, _M_realloc_insert,
 	_M_default_append): Use __relocate_a.
 	(reserve, _M_assign_aux, _M_realloc_insert, _M_fill_insert,
 	_M_default_append, _M_range_insert): Move _GLIBCXX_ASAN_ANNOTATE_REINIT
 	after _Destroy.
 	* testsuite/23_containers/vector/modifiers/push_back/49836.cc:
 	Replace CopyConsOnlyType with DelAnyAssign.

-- 
Marc Glisse
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reloc.patch
Type: text/x-diff
Size: 25182 bytes
Desc: 
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20181013/6e18e39e/attachment.bin>


More information about the Libstdc++ mailing list