This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/7824: Temporary ostream doesn't work properly with operator<< and const char*
- From: bkoz at gcc dot gnu dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, jason at gcc dot gnu dot org, nobody at gcc dot gnu dot org, phil at philipdunstan dot com
- Date: 6 Nov 2002 16:43:47 -0000
- Subject: Re: libstdc++/7824: Temporary ostream doesn't work properly with operator<< and const char*
- Reply-to: bkoz at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, jason at gcc dot gnu dot org, nobody at gcc dot gnu dot org, phil at philipdunstan dot com, gcc-gnats at gcc dot gnu dot org
Synopsis: Temporary ostream doesn't work properly with operator<< and const char*
Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-By: bkoz
Responsible-Changed-When: Wed Nov 6 08:43:44 2002
Responsible-Changed-Why:
Jason, can you take a look at this? If not, maybe Nathan? I think this is an issue with overload resolution and temporaries. Seems odd.
State-Changed-From-To: open->analyzed
State-Changed-By: bkoz
State-Changed-When: Wed Nov 6 08:43:44 2002
State-Changed-Why:
Even simpler:
#include <iostream>
int main()
{
const char* str = "Hello world";
#if 1
// uses operator << void*
std::ostream(std::cerr.rdbuf()) << str << std::endl;
#else
// uses operator << char*
std::cerr << str << std::endl;
#endif
return 0;
}
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7824