This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/48257] std::string::assign() corrupts std::string static data when called on emptyString1 using emptyString2.data()


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48257

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-23 19:39:28 UTC ---
In C++03 see 21.3.5.3 [lib.string.assign] paragraph 6 where 
string::assign(const char* s, size_t n) is defined to return
assign( string(s, n) ) and that constructor:

Constructs an object of class basic_string and determines its initial string
value from the array of charT of length n whose first element is designated by
s, 

In C++0x the requirement is explicit, [string::assign] paragraph 8 says

Requires: s points to an array of at least n elements of charT.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]