This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libstdc++/9555: ostream inserters fail to set badbit on exception


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]