bug in string::substr?

Gerd v. Egidy egidy@deam.de
Wed Nov 17 16:56:00 GMT 1999


Hi,

i use libstdc++ 2.90.6.1 and gcc 2.95.1 and got a segfault within one of my programs.

i tracked it down to this:

string x="abc";
string y;

y=x.substr(1,0);
cerr << y << "\n";

it looks like a substr(x,0) kills the string somehow. i don't exactly know if this is allowed
in ANSI C++, but i think it should at least throw a exception if not.

Regards,

Gerd




More information about the Libstdc++ mailing list