libstdc++/7824: Temporary ostream doesn't work properly with operator<< and const char*

bkoz@gcc.gnu.org bkoz@gcc.gnu.org
Wed Nov 6 08:43:00 GMT 2002


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



More information about the Gcc-bugs mailing list