This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/9561: ostream inserters rethrow exception of wrong type
- From: sebor at roguewave dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 4 Feb 2003 01:05:29 -0000
- Subject: libstdc++/9561: ostream inserters rethrow exception of wrong type
- Reply-to: sebor at roguewave dot com
>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: