https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104909
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It looks wrong, but it's not.
The std::move calls do not actually alter anything, they only cast the argument
to an rvalue reference. Then those rvalue reference are passed to this
constructor:
_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,
_Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::
_Hashtable(_Hashtable&& __ht, __node_alloc_type&& __a,
true_type /* alloc always equal */)
noexcept(_S_nothrow_move())
: __hashtable_base(__ht),
__map_base(__ht),
__rehash_base(__ht),
__hashtable_alloc(std::move(__a)),
The base classes are copied from __ht, then the allocator is moved. That means
that __ht has not been altered by the time we read from the allocator.
The code works correctly.