This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project. See the libstdc++ home page for more information.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
If this is the wrong place to report bugs, sorry...
but I could not find a better one.
Compiling this,
-----------------------snip
#include <string>
#include <cstdio>
using namespace std;
int main()
{
string str1;
string str2;
str1=string("8-chars_")+"5char";
printf("1:%s\n",str1.c_str());
str2=str1+"7-chars";
printf("2:%s\n",str1.c_str()); //str1 is gone
return 0;
}
-----------------------snap
the output of this program should be
1:8-chars_5char
2:8-chars_5char
but is
1:8-chars_5char
2:
with my system:
egcs 1.1.2 (no special compiler options)
libstdc++-2.90.4 (Fifth snapshot)
Linux pc 2.2.5 #4 Wed Apr 21 01:06:44 MEST 1999 i686 unknown
libc-2.0.7
using cout not printf makes no difference, but this confirms
that the error is in string. Changing the length of any
string-literals make the bug vanish, so this bug is obscure
enough that it can pass quite some tests; also strings are marked
to work so I decided to report it.
Alfred