[llvm-bugs] [Bug 49798] New: basic_string::assign doesn't handle iterators into the string itself
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 31 20:18:34 PDT 2021
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: unassignedclangbugs at nondot.org
Reporter: rs2740 at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210401/377bba71/attachment.html>
More information about the llvm-bugs
mailing list