On 7 August 2018 at 17:29, Jonathan Wakely <jwak...@redhat.com> wrote: > On 07/08/18 15:24 +0100, Jonathan Wakely wrote: >> >> This patch fixes the bug, but is it correct? >> >> IIUC the _M_destructive_move effects don't depend on whether move >> assignment is trivial, so should be defined the same way in both >> specializations. It also looks like we can use it in the non-trivial >> move assignment. >> >> Should we define _M_destructive_move on _Move_ctor_base instead of >> _Move_assign_base, so the duplication could be avoided? > > > Or maybe into _Move_ctor_base as in the attached patch. That allows it > to be used in _Copy_assign_base, and means we can omit the try-catch > block when the move construction is trivial. >
_Move_ctor_base seems fine to me. I plan to revamp our variant to bring it up to the changes done before C++17 was done, to fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85517, and I plan to do it shortly.