public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25410]  New: poor ostringstream output
@ 2005-12-14 13:27 aburger at cea dot fr
  2005-12-14 15:11 ` [Bug c++/25410] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: aburger at cea dot fr @ 2005-12-14 13:27 UTC (permalink / raw)
  To: gcc-bugs

The following code compiles, but the result of the first line of main is poor
(it prints the address of the string):

#include <iostream>
#include <sstream>

using namespace std;

template<typename A, typename B>
basic_ostream<A,B>& tic(basic_ostream<A,B>& o)
{
    return o;
}

template<typename A, typename B>
basic_ostream<A,B>& tac(basic_ostream<A,B>& o)
{
    if( ostringstream* oo = dynamic_cast<ostringstream*>(&o) ) {
        cout << oo->str() << endl;
    }
    return o;
}

int main()
{
    ostringstream() << "tac alone does not give a nice result" << tac;
    ostringstream() << tic << "tic+tac together work" << tac;
}

#if 0
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.2 (Debian 4.0.2-2)
#endif


-- 
           Summary: poor ostringstream output
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aburger at cea dot fr
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25410


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

* [Bug c++/25410] poor ostringstream output
  2005-12-14 13:27 [Bug c++/25410] New: poor ostringstream output aburger at cea dot fr
@ 2005-12-14 15:11 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-14 15:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-12-14 15:11 -------


*** 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=25410


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

end of thread, other threads:[~2005-12-14 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-14 13:27 [Bug c++/25410] New: poor ostringstream output aburger at cea dot fr
2005-12-14 15:11 ` [Bug c++/25410] " 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).