[Bug libstdc++/50529] New: std::vector::erase invokes undefined behavior with empty range
delong.j at fb dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 27 00:45:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50529
Bug #: 50529
Summary: std::vector::erase invokes undefined behavior with
empty range
Classification: Unclassified
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: delong.j@fb.com
If you call vector erase() with an empty range, it invokes std::move() with an
output iterator inside of the source range. (I.e. it tries to move all the
elements onto themselves.) This causes problems if some of the elements don't
support self move-assignment (e.g. if they are other std::vectors).
More information about the Gcc-bugs
mailing list