libstdc++/10132: filebuf destructor throws exceptions
Wed Apr 23 03:47:00 GMT 2003

Synopsis: filebuf destructor throws exceptions

State-Changed-From-To: analyzed->feedback
State-Changed-By: bkoz
State-Changed-When: Wed Apr 23 03:47:05 2003
    This is in violation of
    I'm thinking about adding throw() exception specifications to codecvt member funtions. This could be considered a tightening of exception specs, which is allowed in p1 (although I remember some noise when the proposal to add throw() to dtors was suggested.) That should at least make the locale::facet policy on error reporting (22.2 - Standard locale categories p 2) clear, even though it won't necessarily remove the issue.
    To remove it completely, I'd have to do a try around the close() call in basic_filebuf::~basic_filebuf(). And what should happen in the catch? 
    I believe the theory of error handling in the design of the io classes is that basic_ios/basic_istream/basic_ostream throw, catch, and propogate exceptions. The streambuf classes just return eof/-1 (showmanyc, pbackfail, seekoff, seekpos) or NULL (open, close) to report errors. 
    The problem is the intersection of std::locale, which can throw on construction (locale(const char*), combine) and whenever a use_facet is used. Facets, as above, in practice use iostate or some other mechanism to report errors. Although, nothing (except exception-saftey paradoxes) keeps derived/user-defined classes from doing this.

More information about the Gcc-bugs mailing list