This check should be comparing the allocator of the string being moved from (s) with this's allocator. What it is actually doing is comparing the allocator passed in (which is used to initialize this's allocator) with this's allocator. It isn't considering the allocator of the string being moved from at all. As a result swap_data can end up being called with unequal allocators (which is invalid).
The basic_string move constructor without allocator argument appears to do the correct check (line 685).
In the basic_string move constructor with allocator argument:
basic_string(BOOST_RV_REF(basic_string) s, const allocator_type &a)
it does this check (line 715):
if(a == this->alloc()){
Shouldn't this be:
if(s.alloc() == this->alloc()){
This check should be comparing the allocator of the string being moved from (s) with this's allocator. What it is actually doing is comparing the allocator passed in (which is used to initialize this's allocator) with this's allocator. It isn't considering the allocator of the string being moved from at all. As a result swap_data can end up being called with unequal allocators (which is invalid).
The basic_string move constructor without allocator argument appears to do the correct check (line 685).