https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118065
Bug ID: 118065
Summary: Debug Mode does not check non-overlapping
preconditions for std::copy et al
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
#include <algorithm>
int main()
{
int i[1] = { };
std::copy(i, i+1, i);
}
This violates:
Preconditions: result is not in the range [first, last).
but Debug Mode doesn't care.
There are similar preconditions for std::copy_backward, std::move,
std::move_backward.