[
http://issues.apache.org/jira/browse/STDCXX-170?page=comments#action_12376610 ]
Martin Sebor commented on STDCXX-170:
-------------------------------------
Here's another test case for the same problem that should work:
$ cat t.cpp && make t && ./t
#include <cassert>
#include <string>
int main ()
{
std::string s ("abc");
s.replace (s.begin (), s.begin (), s.rbegin () + 1, s.rbegin () + 2);
assert ("babc" == s);
}
gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -pthreads
-D_RWSTD_USE_CONFIG -I/build/sebor/gcc-4.1.0-15s/include
-I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/../rwtest
-I/build/sebor/dev/stdlib/../rwtest/include
-I/build/sebor/dev/stdlib/tests/include -pedantic -nostdinc++ -g -W -Wall
-Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long t.cpp
gcc t.o -o t -L/build/sebor/gcc-4.1.0-15s/rwtest -lrwtest15s -pthreads
-L/build/sebor/gcc-4.1.0-15s/lib -lstd15s -lsupc++ -lm
Assertion failed: "babc" == s, file t.cpp, line 10
Abort (core dumped)
> std::string::replace (iterator, iterator, InputIterator, InputIterator)
> inserting self incorrect
> ------------------------------------------------------------------------------------------------
>
> Key: STDCXX-170
> URL: http://issues.apache.org/jira/browse/STDCXX-170
> Project: C++ Standard Library
> Type: Bug
> Components: 21. Strings
> Versions: 4.1.3
> Environment: all
> Reporter: Anton Pevtsov
> Priority: Minor
>
> This test fails:
> #include <iostream>
> #include <string>
> static const char* test = "babc";
> int main (void)
> {
> std::string s ("abc");
> s.replace (s.begin (), s.begin (), s.begin () + 1, s.begin () + 2);
> std::cout << "Expected " << test << " and got " << s << '\n';
> return 0;
> }
> The output is "Expected babc and got aabc".
> See details here:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200604.mbox/[EMAIL
> PROTECTED]
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira