mirror of
https://github.com/boostorg/exception.git
synced 2025-07-12 12:06:33 +02:00
get_error_info returns raw pointer instead of shared_ptr (breaking change)
diagnostic_information can now be called with boost::exception or std::exception object. BOOST_THROW_EXCEPTION can now be used even if exceptions are disabled. added functions: current_exception_diagnostic_information, current_exception_cast documentation updated to match. [SVN r52225]
This commit is contained in:
47
test/current_exception_cast_test.cpp
Normal file
47
test/current_exception_cast_test.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/current_exception_cast.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <exception>
|
||||
|
||||
class
|
||||
my_exception:
|
||||
public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
class
|
||||
polymorphic
|
||||
{
|
||||
virtual
|
||||
~polymorphic()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw my_exception();
|
||||
}
|
||||
catch(
|
||||
std::exception & e )
|
||||
{
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
...)
|
||||
{
|
||||
BOOST_TEST(boost::current_exception_cast<std::exception>()==&e);
|
||||
BOOST_TEST(!boost::current_exception_cast<polymorphic>());
|
||||
}
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user