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++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length


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.


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