Opened 9 years ago

Last modified 6 years ago

#9088 new Bugs

I/O Exception state & status savers may cause std::terminate in C++11

Reported by: Daryle Walker Owned by: Daryle Walker
Milestone: To Be Determined Component: io
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

The boost::io::basic_ios_iostate_saver and boost::io::basic_ios_exception_saver class templates in file "boost/io/ios_state.hpp" alter the I/O exception state and trigger-mask, respectively, in their constructors and destructors. When a change in either makes the two statuses have a non-zero result when combined with bitwise-and, an exception is thrown.

A potentially throwing destructor is problematic enough, but C++11 adds a new source of trouble. C++11 declares all destructors with no exception specification to be noexcept by default, which makes all imported pre-C++11 types with a throwing destructor to call std::terminate if they throw. The (immediate) fix would be to add a noexcept(false) specification to those destructors when used in C++11 mode.

Change History (2)

comment:1 by Daryle Walker, 9 years ago

Class template boost::io::basic_ios_all_saver, in the same header file, has the same issue (as it's a pseudo-composite class).

comment:2 by Robert Ramey, 6 years ago

It seems that this is causing test failure on the library for the last 3 years. Any chance of getting this fixed?

Note: See TracTickets for help on using tickets.