This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
temporary ostream bug
- From: Philip Dunstan <phil at philipdunstan dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 4 Sep 2002 15:11:07 +0800 (WST)
- Subject: temporary ostream bug
The following code prints out the address of the constant string instead
of the string itself. The details are:
eg
0x8048920
0x8048920
instead of
0x8048920
Hello world
#include <iostream>
int main ()
{
const char* str = "Hello world";
std::cout << static_cast<const void *>(str) << std::endl;
std::ostream(std::cout.rdbuf()) << str << std::endl;
return 0;
}
The machine details are
phoenix 15> uname -a
Linux phoenix 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 unknown
phoenix 16> gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)
Phil
--
Philip Dunstan
phil@philipdunstan.com
http://www.philipdunstan.com/
mobile 0404 880 874