This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
bugreport:string error
- To: libstdc++@sourceware.cygnus.com
- Subject: bugreport:string error
- From: "a8601248 (Alfred Minarik)" <a8601248@unet.univie.ac.at>
- Date: Sat, 01 May 1999 10:58:50 +0200
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