[PATCH] libstdc++/92124 for associative containers

François Dumont frs.dumont@gmail.com
Tue Jan 7 21:05:00 GMT 2020


On 1/6/20 11:07 PM, Jonathan Wakely wrote:
> On 06/01/20 22:37 +0100, François Dumont wrote:
>> On 1/6/20 4:19 PM, Jonathan Wakely wrote:
>>> On 03/01/20 22:04 +0100, François Dumont wrote:
>>>> 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?
>>>
>>
>> PR 92124 says that we should move even if assignment operator is not 
>> noexcept that is to say noexcept(false). If the assignment operator 
>> is noexcept(true) we were already doing the right thing, no ?
>
> No. move_if_noexcept only considers the exception-specification of the
> move **constructor**, not the move assignment operator.
>
> That's the crux of the issue: we were deciding whether to do move
> assignment or copy assignment based on properties of the constructors,
> but the constructrs should be irrelevant when assigning.
>
Ok, I was only aware of removing the noexcept check to move. I didn't 
notice that moreover we were not checking the correct qualification.

To make sure that we move even if noexcept I think this change would be 
nice but as it is a minor issue I committed without it.

François



More information about the Libstdc++ mailing list