[Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
michael.haubenwallner at salomon dot at
gcc-bugzilla@gcc.gnu.org
Wed Aug 29 10:50:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392
--- Comment #4 from Michael Haubenwallner <michael.haubenwallner at salomon dot at> 2012-08-29 10:50:22 UTC ---
(In reply to comment #0)
Extending the testcase shows even more bad behavior in 4.4.3 and earlier:
#include <string>
#include <cassert>
int main()
{
std::string s1, s2;
s1.assign(s2.c_str(), 1);
assert( s1.size() == 1 );
std::string s3;
assert( s3.size() == 0 ); // up to gcc-4.4.3 fail here
}
More information about the Gcc-bugs
mailing list