public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17181] New: stringstream temporary stores pointer to string as string
@ 2004-08-25  7:16 bjornpearson at linuxmail dot org
  2004-08-25  7:24 ` [Bug c++/17181] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: bjornpearson at linuxmail dot org @ 2004-08-25  7:16 UTC (permalink / raw)
  To: gcc-bugs

When passing a stringstream temporary to a function the address of the string is
converted to a string and stored in the stringstream.  Replacing the code with
tempBug(stringstream() << 1 << "Hello World!"); has the expected result (minus
the 1 prefix).

Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.1/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.1 20040815 (Red Hat 3.4.1-8)
 /usr/libexec/gcc/i386-redhat-linux/3.4.1/cc1plus -E -quiet -v -D_GNU_SOURCE
sstr.cpp -Wall -o sstr.ii
ignoring nonexistent directory
"/usr/lib/gcc/i386-redhat-linux/3.4.1/../../../../i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i386-redhat-linux/3.4.1/../../../../include/c++/3.4.1
 /usr/lib/gcc/i386-redhat-linux/3.4.1/../../../../include/c++/3.4.1/i386-redhat-linux
 /usr/lib/gcc/i386-redhat-linux/3.4.1/../../../../include/c++/3.4.1/backward
 /usr/local/include
 /usr/lib/gcc/i386-redhat-linux/3.4.1/include
 /usr/include
End of search list.
 /usr/libexec/gcc/i386-redhat-linux/3.4.1/cc1plus -fpreprocessed sstr.ii -quiet
-dumpbase sstr.cpp -auxbase sstr -Wall -version -o sstr.s
GNU C++ version 3.4.1 20040815 (Red Hat 3.4.1-8) (i386-redhat-linux)
        compiled by GNU C version 3.4.1 20040815 (Red Hat 3.4.1-8).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64542
 as -V -Qy -o sstr.o sstr.s
GNU assembler version 2.15.91.0.2 (i386-redhat-linux) using BFD version
2.15.91.0.2 20040727
 /usr/libexec/gcc/i386-redhat-linux/3.4.1/collect2 --eh-frame-hdr -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 -o sstr
/usr/lib/gcc/i386-redhat-linux/3.4.1/../../../crt1.o
/usr/lib/gcc/i386-redhat-linux/3.4.1/../../../crti.o
/usr/lib/gcc/i386-redhat-linux/3.4.1/crtbegin.o
-L/usr/lib/gcc/i386-redhat-linux/3.4.1 -L/usr/lib/gcc/i386-redhat-linux/3.4.1
-L/usr/lib/gcc/i386-redhat-linux/3.4.1/../../.. -lstdc++sstr.o -lgcc --as-needed
-lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/i386-redhat-linux/3.4.1/crtend.o
/usr/lib/gcc/i386-redhat-linux/3.4.1/../../../crtn.o


--Begin Source--
#include <sstream>
#include <iostream>

int tempBug(std::ostream& os)
{
        std::stringstream& ss = static_cast<std::stringstream &> (os);

        std::cout << ss.str() << std::endl;

        return 0;
}

int main(int argc, char** argv)
{
        return tempBug(std::stringstream() << "Hello World!");
}
--End Source--

-- 
           Summary: stringstream temporary stores pointer to string as
                    string
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bjornpearson at linuxmail dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/17181] stringstream temporary stores pointer to string as string
  2004-08-25  7:16 [Bug c++/17181] New: stringstream temporary stores pointer to string as string bjornpearson at linuxmail dot org
@ 2004-08-25  7:24 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-25  7:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-25 07:23 -------


*** This bug has been marked as a duplicate of 9925 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2004-08-25  7:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-25  7:16 [Bug c++/17181] New: stringstream temporary stores pointer to string as string bjornpearson at linuxmail dot org
2004-08-25  7:24 ` [Bug c++/17181] " 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).