[PATCH] Fix _GLIBCXX_DEBUG container allocator aware move constructors

François Dumont frs.dumont@gmail.com
Sun Mar 28 20:27:24 GMT 2021


On 27/03/21 10:07 pm, Jonathan Wakely wrote:
> On 26/03/21 21:41 +0100, François Dumont via Libstdc++ wrote:
>> I review the allocator aware move constructors of _GLIBCXX_DEBUG 
>> containers.
>>
>> I think the recently added __gnu_debug basic_string one is also 
>> missing the rvalue reference, no ?
>
> You mean is_nothrow_constructible<Base, Base&&, const Alloc&> instead
> of is_nothrow_constructible<Base,Base, const Alloc&>?
>
> No, it's not missing. They mean the exact same thing: Base is an
> rvalue, Base&& is an rvalue, and Base& is an lvalue. Writing Base&&
> instead of Base is just extra noise that adds no value.
>
Ok, noted.
>
>>     libstdc++: _GLIBCXX_DEBUG Fix allocator aware move constructor
>
> The correct term is "allocator-extended move constructor". And is it
> really a "fix"? The standard doesn't require a noexcept-specifier on
> those constructors, so what we have now is not incorrect, just
> suboptimal.

For the debug list it is a fix because we were missing the _Safe base 
class call. For the vector it is also a fix even if a minor one.

>
>>     Fix several allocator aware move construtor in _GLIBCXX_DEBUG
>>     containers.
>>
>>     libstdc++-v3/ChangeLog:
>>             * include/debug/forward_list
>>             (forward_list(forward_list&&, const allocator_type&)): 
>> Add noexcept qualification.
>>             * include/debug/list (list(list&&, const 
>> allocator_type&)): Likewise and add
>>             call to safe container allocator aware move constructor.
>>             * include/debug/string (basic_string(basic_string&&, 
>> const _Allocator&)):
>>             Check base type allocator aware more constructor.
>>             * include/debug/vector (vector(vector&&, const 
>> allocator_type&)):
>>             Fix noexcept qualification.
>>             * 
>> testsuite/23_containers/forward_list/cons/noexcept_move_construct.cc:
>>             Add allocator aware move constructor noexceot 
>> qualification check.
>>             * 
>> testsuite/23_containers/list/cons/noexcept_move_construct.cc: Likewise.
>>
>> Tested under linux x86_64.
>>
>> Ok to commit ?
>
> OK, thanks.
>
>
I eventually committed the attached patch.

If you are still interested by _GLIBCXX_DEBUG fixes there is still this one:

https://gcc.gnu.org/pipermail/libstdc++/2021-March/052176.html

Thanks,

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_noexcept-cons.patch
Type: text/x-patch
Size: 3452 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210328/75f70ebc/attachment.bin>


More information about the Libstdc++ mailing list