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: unassig...@gcc.gnu.org ReportedBy: delon...@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).