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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to