mirror of
https://github.com/boostorg/exception.git
synced 2025-07-16 05:52:14 +02:00
Removed boost::exception::what, to avoid ambiguity in user types deriving from both std::exception and boost::exception.
[SVN r46930]
This commit is contained in:
@ -29,7 +29,6 @@ run throw_exception_test.cpp helper2.cpp ;
|
||||
run errno_test.cpp ;
|
||||
run error_info_test.cpp ;
|
||||
run diagnostic_information_test.cpp ;
|
||||
run what_test.cpp ;
|
||||
compile-fail exception_fail.cpp ;
|
||||
compile-fail throw_exception_fail.cpp ;
|
||||
|
||||
|
@ -44,26 +44,20 @@ get_diagnostic_information( std::exception const & x )
|
||||
return boost::diagnostic_information(x);
|
||||
}
|
||||
|
||||
std::string
|
||||
get_what( std::exception const & x )
|
||||
{
|
||||
return x.what();
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost;
|
||||
{
|
||||
error1 x;
|
||||
BOOST_TEST(get_what(x)=="error1");
|
||||
BOOST_TEST(x.what()==std::string("error1"));
|
||||
std::string di=get_diagnostic_information(x);
|
||||
BOOST_TEST(di.find("type:")!=std::string::npos);
|
||||
BOOST_TEST(di.find("error1")!=std::string::npos);
|
||||
}
|
||||
{
|
||||
error2 x; x << tag_int(42);
|
||||
BOOST_TEST(get_what(x)=="error2");
|
||||
BOOST_TEST(x.what()==std::string("error2"));
|
||||
std::string di=get_diagnostic_information(x);
|
||||
BOOST_TEST(di.find("type:")!=std::string::npos);
|
||||
BOOST_TEST(di.find("error2")!=std::string::npos);
|
||||
|
@ -46,7 +46,6 @@ main()
|
||||
{
|
||||
BOOST_TEST( 42==*boost::get_error_info<test_int>(x) );
|
||||
BOOST_TEST( std::string(x.what())==std::string("exception test length error") );
|
||||
BOOST_TEST( std::string(x.what())!=std::string(boost::diagnostic_information(x)) );
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
|
@ -1,32 +0,0 @@
|
||||
//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/exception.hpp>
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
struct
|
||||
test_exception:
|
||||
std::exception,
|
||||
boost::exception
|
||||
{
|
||||
char const *
|
||||
what() const throw()
|
||||
{
|
||||
return "test_exception";
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test_exception x;
|
||||
std::exception & sx(x);
|
||||
boost::exception & bx(x);
|
||||
BOOST_TEST(std::string(sx.what())=="test_exception");
|
||||
BOOST_TEST(std::string(bx.what())=="test_exception");
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user