stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-25) string::insert() curruption inserting self
Date Wed, 14 Sep 2005 18:30:55 GMT
string::insert() curruption inserting self
------------------------------------------

         Key: STDCXX-25
         URL: http://issues.apache.org/jira/browse/STDCXX-25
     Project: STDCXX
        Type: Bug
  Components: 21. Strings  
    Versions: 4.1.2    
 Environment: All
    Reporter: Martin Sebor
 Assigned to: Martin Sebor 
     Fix For: 4.1.3


The program below aborts. According to 21.3.5.4, p16 of C++ '03, the effects of the insert
member function template are "Equivalent to insert(p - begin(), basic_string(first, last))."
See also http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#7.

$ cat t.cpp && nice gmake SRCS=t.cpp && ./t
#include <cassert>
#include <string>

int main ()
{
     std::string s ("ab");

     s.insert (s.begin () + 1, s.data (), s.data () + s.length ());

     assert ("aabb" == s);
}
aCC -c  -D_RWSTDDEBUG  -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/../../aCC-6.0-11s/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  -AA -g +d   +w +W392 +W655 +W684 +W818 +W819 +W849
+W2193 +W2236 +W2261 +W2340 +W2401 +W2487  t.cpp 
aCC t.o -o t -L/build/sebor/dev/stdlib/../../aCC-6.0-11s/rwtest -lrwtest -AA +nostl -Wl,+s
-L/build/sebor/dev/stdlib/../../aCC-6.0-11s/lib    -L/build/sebor/dev/stdlib/../../aCC-6.0-11s/lib
-lstd   -lm  
Assertion failed: "aabb" == s, file t.cpp, line 10
ABORT instruction (core dumped)


-- 
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


Mime
View raw message