Issue Details (XML | Word | Printable)

Key: STDCXX-629
Type: Bug Bug
Status: Reopened Reopened
Priority: Minor Minor
Assignee: Unassigned
Reporter: Farid Zaripov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

std::string::assign (reverse_iterator, reverse_iterator) assigning self incorrect

Created: 01/Nov/07 06:10 PM   Updated: 11/Jul/09 12:06 AM
Return to search
Component/s: 21. Strings
Affects Version/s: 4.1.2, 4.1.3, 4.1.4, 4.2.0
Fix Version/s: 4.3.0

Time Tracking:
Not Specified

Environment: All
Issue Links:
Dependants
 
dependent
 

Severity: Incorrect Behavior


 Description  « Hide
The 21.string.assign.cpp test has been failing a number of assertions for self-referential test cases that exercise the ability to assign a substring of a string into itself using the assign(InputIterator, InputIterator) member template specialization for InputIterator being an actual reverse_iterator. The program below reproduces the problem in a small isolated test case.

#include <cassert>
#include <string>

int main ()
{
std::string s ("abc");
s.assign (s.rbegin () + 1, s.rend ());
assert ("ba" == s);
}



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Farid Zaripov added a comment - 01/Nov/07 06:11 PM
Since string::assign() is implemented in terms of replace() resolving STDCXX-170 will also resolve this issue.

Farid Zaripov added a comment - 22/Feb/08 05:42 PM
Fixed in STDCXX-170.

Will be closed after adding the regression test for the issue.


Farid Zaripov added a comment - 17/Mar/08 02:32 PM
The STDCXX-170 issue is reverted and deferred to 4.3 release.
Deferring this issue too.

Farid Zaripov added a comment - 17/Mar/08 02:38 PM
The regression test added in trunk thus: http://svn.apache.org/viewvc?rev=635444&view=rev