libstdc++/17: cout is not a real ostream; dynamic_cast SEGV's as a result
pbd@op.net
pbd@op.net
Fri Dec 3 17:57:00 GMT 1999
>Number: 17
>Category: libstdc++
>Synopsis: cout is not a real ostream; dynamic_cast SEGV's as a result
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Dec 03 17:57:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: pbd@op.net
>Release: 2.9.0
>Organization:
>Environment:
RedHat Linux, egcs 1.1.2
>Description:
because cout is not a real ostream, but a _fake_ostream,
dynamic_cast<ClassDerivedFromOstream *> will fail
when applied to a pointer or reference to cout.
given that "ostream cout" is apparently part of the
"standard library", not having cout actually be a
real ostream is not good.
i think. :)
>How-To-Repeat:
compile this program: c++ -o k.k.cc
run it, watch it SEGV when attempting a dynamic cast
on the pointer to cout.
>Fix:
cout should be a real ostream, not a _fake_ostream.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="k.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="k.cc"
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgVHJhbnNtaXR0ZXIgOiBwdWJsaWMgb3N0cmVhbQoK
ewp9OwoKdm9pZCAKdHJ5X2Nhc3QgKG9zdHJlYW0gKm9zdHIpCgp7CglUcmFuc21pdHRlciAqdHA7
CgoJdHAgPSBkeW5hbWljX2Nhc3Q8VHJhbnNtaXR0ZXIgKj4gKG9zdHIpOwoJY291dCA8PCAidHAg
PSAiIDw8IGhleCA8PCAoaW50KSB0cCA8PCBkZWMgPDwgZW5kbDsKfQkKCm1haW4gKCkKCnsKCVRy
YW5zbWl0dGVyIHQ7Cglvc3RyZWFtIGZvbzsKCgl0cnlfY2FzdCAoJnQpOwoJdHJ5X2Nhc3QgKCZm
b28pOwoJdHJ5X2Nhc3QgKCZjb3V0KTsKfQoJCg==
More information about the Libstdc++-prs
mailing list