[Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 28 13:42:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392
Bug #: 54392
Summary: [4.6/4.7/4.8 Regression] std::string::append() fails
to update length
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: redi@gcc.gnu.org
#include <string>
#include <cassert>
int main()
{
std::string s1, s2;
s1.assign(s2.c_str(), 1);
assert( s1.size() == 1 );
}
This test passes with G++ 4.4, but in 4.5 and later string::assign(const char*,
size_type) doesn't mutate the string but tries to work in-place on the empty
rep, then tries (and fails) to set the length of the empty rep to 1.
More information about the Gcc-bugs
mailing list