public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/7824: Temporary ostream doesn't work properly with operator<< and const char*
@ 2002-11-06  8:43 bkoz
  0 siblings, 0 replies; 4+ messages in thread
From: bkoz @ 2002-11-06  8:43 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jason, nobody, phil

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/7824: Temporary ostream doesn't work properly with operator<< and const char*
@ 2002-11-06 11:36 Benjamin Kosnik
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Kosnik @ 2002-11-06 11:36 UTC (permalink / raw)
  To: jason; +Cc: gcc-prs

The following reply was made to PR libstdc++/7824; it has been noted by GNATS.

From: Benjamin Kosnik <bkoz@redhat.com>
To: Martin Sebor <sebor@roguewave.com>
Cc: bkoz@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/7824: Temporary ostream doesn't work properly with operator<< and const char*
Date: Wed, 6 Nov 2002 13:28:08 -0600

 >That's the correct behavior. The char* non-member inserter takes
 >a non-const reference, so it's not a viable match. The void*
 >inserter is a member, so it is called for the unnamed temporary
 >(rvalue). We got the same report a while ago :)
 
 A ha! Thanks Martin. 
 
 I'll close this now...
 
 -benjamin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/7824: Temporary ostream doesn't work properly with operator<< and const char*
@ 2002-11-06 11:31 bkoz
  0 siblings, 0 replies; 4+ messages in thread
From: bkoz @ 2002-11-06 11:31 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jason, phil

Synopsis: Temporary ostream doesn't work properly with operator<< and const char*

State-Changed-From-To: analyzed->closed
State-Changed-By: bkoz
State-Changed-When: Wed Nov  6 11:31:03 2002
State-Changed-Why:
    Not a bug.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7824


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/7824: Temporary ostream doesn't work properly with operator<< and const char*
@ 2002-11-06  9:56 Martin Sebor
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Sebor @ 2002-11-06  9:56 UTC (permalink / raw)
  To: jason; +Cc: gcc-prs

The following reply was made to PR libstdc++/7824; it has been noted by GNATS.

From: Martin Sebor <sebor@roguewave.com>
To: bkoz@gcc.gnu.org,  gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: libstdc++/7824: Temporary ostream doesn't work properly with
 operator<< and const char*
Date: Wed, 06 Nov 2002 10:52:45 -0700

 bkoz@gcc.gnu.org wrote:
 > 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.
 
 That's the correct behavior. The char* non-member inserter takes
 a non-const reference, so it's not a viable match. The void*
 inserter is a member, so it is called for the unnamed temporary
 (rvalue). We got the same report a while ago :)
 
 Regards
 Martin
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-11-06 19:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-06  8:43 libstdc++/7824: Temporary ostream doesn't work properly with operator<< and const char* bkoz
2002-11-06  9:56 Martin Sebor
2002-11-06 11:31 bkoz
2002-11-06 11:36 Benjamin Kosnik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).