libstdc++/9555: ostream inserters fail to set badbit on exception
sebor@roguewave.com
sebor@roguewave.com
Mon Feb 3 20:26:00 GMT 2003
>Number: 9555
>Category: libstdc++
>Synopsis: ostream inserters fail to set badbit on exception
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 03 20:26:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: sebor@roguewave.com
>Release: 3.2.1
>Organization:
>Environment:
>Description:
The expected exit status of the program below is 0. When compiled with gcc 3.2.1 and the supplied libstdc++, it is 1, indicating that the inserter fails to set badbit when an exception occurs during output.
Regards
Martin
>How-To-Repeat:
#include <ostream>
#include <streambuf>
struct buf: std::streambuf
{
virtual int_type overflow (int_type) {
throw 0;
return -1;
}
};
int main ()
{
buf b;
std::ostream strm (&b);
strm.exceptions (std::ios::badbit);
try {
strm << 0;
}
catch (int) {
return !(strm.bad ());
}
catch (...) {
return 2;
}
return 3;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list