public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26040] New: funny ::std::ostream behavior when using a temporary
@ 2006-01-31 1:17 Raimund dot Merkert at baesystems dot com
2006-01-31 1:20 ` [Bug c++/26040] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: Raimund dot Merkert at baesystems dot com @ 2006-01-31 1:17 UTC (permalink / raw)
To: gcc-bugs
I'm having trouble understanding what's going on here. Is this a bug in G++ or
possible is the C++ standard a little bit funny, or is it STL?
Perhaps, the result of this code undefined due to the temporary?
I would have expected as output
Hello
Hello
The rationale for this example is the following: I'd like to write a log class
that extends an ostream and I want to use roughly like this:
LogEntry(INFO) << "MyMessage" << LogEntry::commit;
#include <sstream>
#include <iostream>
int main()
{
::std::ostringstream ss;
ss << "Hello" ;
::std::cerr << ss.str() << ::std::endl;
::std::string s = static_cast< ::std::ostringstream&>(::std::ostringstream()
<< "Hello2").str();
::std::cerr << s << ::std::endl;
return 0;
}
--
Summary: funny ::std::ostream behavior when using a temporary
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Raimund dot Merkert at baesystems dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26040
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/26040] funny ::std::ostream behavior when using a temporary
2006-01-31 1:17 [Bug c++/26040] New: funny ::std::ostream behavior when using a temporary Raimund dot Merkert at baesystems dot com
@ 2006-01-31 1:20 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-31 1:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-01-31 01:20 -------
*** This bug has been marked as a duplicate of 9925 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26040
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-01-31 1:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-31 1:17 [Bug c++/26040] New: funny ::std::ostream behavior when using a temporary Raimund dot Merkert at baesystems dot com
2006-01-31 1:20 ` [Bug c++/26040] " pinskia at gcc dot gnu dot org
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).