This code:

#include    <sstream>
#include    <iostream>

int main() {
    std::cerr << static_cast<std::stringstream&>(std::stringstream() << "foo"
        << "bar").str() << "\n";
    return 0;
    }


prints:

~/ootbc/members/src$ a.out
0x8048c58bar

The "foo" operand is being formatted as a pointer rather than a C string.
Strangely, the second "bar" operand is formatted correctly.

Ivan


-- 
           Summary: problem with std::stringstream
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net


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

Reply via email to