On Mon, 18 Aug 2025 at 09:16, Tomasz Kaminski wrote:
>
> The overlapping range, will lead to move from moved-from object, which I 
> think is generally expected to work.

But move_backward has a precondition that "result is not in the range
(first, last]" and we don't check that with an assertion.

We have overloads of std::__copy_move_a and
std::__copy_move_backward_a for _Safe_iterator, which do have some
debug assertions, but when we call move_backward inside
vector::insert_range we're dealing with the unsafe iterators, so we
don't use the overloads with range checking. And the overloads with
debug assertions only check for valid ranges, they don't check for
overlapping ranges.

> My preference is to land this fix for us misbehaving for correct inputs, and 
> consider any additional assertions separately.

Yes adding any new assertions is definitely a separate issue to be
considered at some point. I've opened Bug 121598 for it.

Reply via email to