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

            Bug ID: 49798
           Summary: basic_string::assign doesn't handle iterators into the
                    string itself
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: rs2...@gmail.com
                CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com

basic_string::assign, unlike the containers', needs to tolerate the case where
the iterators refers into the string. See https://wg21.link/string.assign#15,
which depicts a temporary string being constructed before any mutation takes
place.

Test case:

    std::string s = "abcde";
    s.assign(s.rbegin(), s.rend());
    assert(s == "edcba");

I suspect, but have not checked, that other member functions taking iterator
pairs may have similar issues.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to