[LLVMbugs] [Bug 23767] New: Incorrect invalidation of iterator when using ranged deque::erase for first element in deque of size 2.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 4 18:40:52 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23767

            Bug ID: 23767
           Summary: Incorrect invalidation of iterator when using ranged
                    deque::erase for first element in deque of size 2.
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hocheung20 at gmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 14439
  --> https://llvm.org/bugs/attachment.cgi?id=14439&action=edit
Short test program illustrating ranged deque::erase bug.

According to the standard, all iterators and references are invalidated, unless
the erased elements are at the end or the beginning of the container, in which
case only the iterators and references to the erased elements are invalidated.

In the case of deque of size 2, if you used ranged erase for remove the first
element. Any iterators to the last element will no longer be valid.

See attached example program.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150605/8f5a8606/attachment.html>


More information about the llvm-bugs mailing list