[PATCH] libstdc++/92124 for associative containers

Jonathan Wakely jwakely@redhat.com
Mon Jan 6 22:07:00 GMT 2020


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.



More information about the Libstdc++ mailing list