This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 28 Aug 2012 13:42:00 +0000
- Subject: [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length
- Auto-submitted: auto-generated
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.