public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/9561: ostream inserters rethrow exception of wrong type
@ 2003-02-04  1:06 sebor
  0 siblings, 0 replies; 2+ messages in thread
From: sebor @ 2003-02-04  1:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9561
>Category:       libstdc++
>Synopsis:       ostream inserters rethrow exception of wrong type
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 04 01:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     sebor@roguewave.com
>Release:        3.2.1
>Organization:
>Environment:

>Description:
The program below is expected to exit with the status of 0 but when compiled with gcc/libstdc++ 3.2.1 it exits with 2, indicating that the inserter throws an exception of the wrong type instead of the one thrown from overflow.

Regards
Martin
>How-To-Repeat:
#include <ostream>
#include <streambuf>

struct foobar: std::exception { };

struct buf: std::streambuf
{
    virtual int_type overflow (int_type) {
        throw foobar ();
        return -1;
    }
};

int main ()
{
    buf b;

    std::ostream strm (&b);

    strm.exceptions (std::ios::badbit);

    try {
        strm << std::endl;
    }
    catch (foobar) {
        return !(strm.bad ());
    }
    catch (...) {
        return 2;
    }

    return 3;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: libstdc++/9561: ostream inserters rethrow exception of wrong type
@ 2003-03-22  5:15 jlquinn
  0 siblings, 0 replies; 2+ messages in thread
From: jlquinn @ 2003-03-22  5:15 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jlquinn, nobody, sebor

Synopsis: ostream inserters rethrow exception of wrong type

Responsible-Changed-From-To: unassigned->jlquinn
Responsible-Changed-By: jlquinn
Responsible-Changed-When: Sat Mar 22 05:15:16 2003
Responsible-Changed-Why:
    Fixed the bug
State-Changed-From-To: open->closed
State-Changed-By: jlquinn
State-Changed-When: Sat Mar 22 05:15:16 2003
State-Changed-Why:
    Fixed in 3.3 and 3.4/mainline.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9561


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

end of thread, other threads:[~2003-03-22  5:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-04  1:06 libstdc++/9561: ostream inserters rethrow exception of wrong type sebor
2003-03-22  5:15 jlquinn

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).