forked from boostorg/io
Fix for gcc and clang. Right now gcc throws an old ABI version of std::ios_base::failure even when the version being used is the newer ABI version of std::ios_base::failure. I have been told that this will be fixed in gcc-7.
This commit is contained in:
+13
-2
@@ -10,6 +10,7 @@
|
||||
// 15 Jun 2003 Adjust to changes in Boost.Test (Daryle Walker)
|
||||
// 26 Feb 2002 Initial version (Daryle Walker)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/test/minimal.hpp> // main, BOOST_CHECK, etc.
|
||||
|
||||
#include <boost/cstdlib.hpp> // for boost::exit_success
|
||||
@@ -24,7 +25,9 @@
|
||||
#include <ostream> // for std::endl, std::ostream
|
||||
#include <streambuf> // for std::streambuf
|
||||
#include <string> // for std::string
|
||||
|
||||
#if defined(BOOST_GCC)
|
||||
#include <stdexcept>
|
||||
#endif
|
||||
|
||||
// Facet with the bool names spelled backwards
|
||||
class backward_bool_names
|
||||
@@ -181,11 +184,15 @@ saver_tests_1
|
||||
boost::io::ios_exception_saver const ies( output );
|
||||
boost::io::ios_iostate_saver const iis( output );
|
||||
|
||||
output.exceptions( ios_base::eofbit );
|
||||
output.exceptions( ios_base::eofbit | ios_base::badbit );
|
||||
output.setstate( ios_base::eofbit );
|
||||
BOOST_ERROR( "previous line should have thrown" );
|
||||
}
|
||||
#if defined(BOOST_GCC) || (defined(BOOST_CLANG) && defined(BOOST_GNU_STDLIB))
|
||||
catch ( std::exception &f )
|
||||
#else
|
||||
catch ( ios_base::failure &f )
|
||||
#endif
|
||||
{
|
||||
err << "Got the expected I/O failure: \"" << f.what() << "\".\n";
|
||||
BOOST_CHECK( output.exceptions() == ios_base::goodbit );
|
||||
@@ -243,7 +250,11 @@ saver_tests_2
|
||||
|
||||
BOOST_ERROR( "previous line should have thrown" );
|
||||
}
|
||||
#if defined(BOOST_GCC) || (defined(BOOST_CLANG) && defined(BOOST_GNU_STDLIB))
|
||||
catch ( std::exception &f )
|
||||
#else
|
||||
catch ( ios_base::failure &f )
|
||||
#endif
|
||||
{
|
||||
err << "Got the expected I/O failure: \"" << f.what() << "\".\n";
|
||||
BOOST_CHECK( output.exceptions() == ios_base::goodbit );
|
||||
|
||||
Reference in New Issue
Block a user