public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/50529] New: std::vector::erase invokes undefined behavior with empty range
@ 2011-09-27  0:45 delong.j at fb dot com
  2011-09-27  1:56 ` [Bug libstdc++/50529] [C++0x] " paolo.carlini at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: delong.j at fb dot com @ 2011-09-27  0:45 UTC (permalink / raw)
  To: gcc-bugs

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).


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-09-30 20:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-27  0:45 [Bug libstdc++/50529] New: std::vector::erase invokes undefined behavior with empty range delong.j at fb dot com
2011-09-27  1:56 ` [Bug libstdc++/50529] [C++0x] " paolo.carlini at oracle dot com
2011-09-27  1:57 ` paolo.carlini at oracle dot com
2011-09-27  2:56 ` paolo at gcc dot gnu.org
2011-09-27  4:15 ` paolo.carlini at oracle dot com
2011-09-27  7:56 ` delong.j at fb dot com
2011-09-30 21:16 ` paolo at gcc dot gnu.org
2011-09-30 23:36 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).