diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8274b1..edf1df2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,7 +138,7 @@ jobs: - name: Run tests run: | cd ../boost-root - ./b2 -j3 libs/exception/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release exception-handling=on,off rtti=on,off + ./b2 -j3 libs/exception/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release exception-handling=on,off rtti=on,off link=static,shared visibility=hidden,global windows: strategy: diff --git a/include/boost/exception/detail/type_info.hpp b/include/boost/exception/detail/type_info.hpp index 94cca7f..0d46fd6 100644 --- a/include/boost/exception/detail/type_info.hpp +++ b/include/boost/exception/detail/type_info.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #ifndef BOOST_EXCEPTION_ENABLE_WARNINGS #if __GNUC__*100+__GNUC_MINOR__>301 @@ -69,7 +70,7 @@ boost bool operator<( type_info_ const & a, type_info_ const & b ) { - return 0!=(a.type_->before(*b.type_)); + return a.type_!=b.type_ && strcmp(a.type_->name(), b.type_->name()) < 0; } }; } diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp index b649574..86d558b 100644 --- a/include/boost/exception/info.hpp +++ b/include/boost/exception/info.hpp @@ -86,9 +86,6 @@ boost if( info_.end()!=i ) { shared_ptr const & p = i->second; -#ifndef BOOST_NO_RTTI - BOOST_ASSERT( *BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==*ti.type_ ); -#endif return p; } return shared_ptr(); diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 5ca7c2e..90345bb 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -7,11 +7,6 @@ import testing ; -project - : requirements - static - ; - #to_string run is_output_streamable_test.cpp ; @@ -47,6 +42,9 @@ run errinfos_test.cpp : : : on ; run exception_ptr_test.cpp/BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR ../../thread/src/tss_null.cpp /boost/exception /boost//thread : : : multi on : non_intrusive_exception_ptr_test ; run exception_ptr_test.cpp ../../thread/src/tss_null.cpp /boost//thread : : : multi on ; +lib visibility_test_lib : visibility_test_lib.cpp : hidden on ; +run visibility_test.cpp visibility_test_lib/shared : : : hidden on ; + compile-fail exception_fail.cpp ; compile-fail throw_exception_fail.cpp ; compile-fail error_info_const_fail.cpp ; diff --git a/test/visibility_test.cpp b/test/visibility_test.cpp new file mode 100644 index 0000000..362c63b --- /dev/null +++ b/test/visibility_test.cpp @@ -0,0 +1,32 @@ +//Copyright (c) 2006-2009 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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + +#include "visibility_test_lib.hpp" +#include +#include + +void BOOST_SYMBOL_IMPORT hidden_throw(); + +int +main() + { + try + { + hidden_throw(); + BOOST_TEST(false); + } + catch( + my_exception & e ) + { + BOOST_TEST(boost::get_error_info(e) && *boost::get_error_info(e)==42); + } + return boost::report_errors(); + } diff --git a/test/visibility_test_lib.cpp b/test/visibility_test_lib.cpp new file mode 100644 index 0000000..6e566fe --- /dev/null +++ b/test/visibility_test_lib.cpp @@ -0,0 +1,9 @@ +#include "visibility_test_lib.hpp" +#include + +void +BOOST_SYMBOL_EXPORT +hidden_throw() + { + BOOST_THROW_EXCEPTION(my_exception() << my_info(42)); + } diff --git a/test/visibility_test_lib.hpp b/test/visibility_test_lib.hpp new file mode 100644 index 0000000..56c0d13 --- /dev/null +++ b/test/visibility_test_lib.hpp @@ -0,0 +1,15 @@ +#ifndef HIDDEN_HPP_INCLUDED +#define HIDDEN_HPP_INCLUDED + +//Copyright (c) 2006-2009 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 + +typedef boost::error_info my_info; + +struct BOOST_SYMBOL_VISIBLE my_exception: virtual std::exception, virtual boost::exception { }; + +#endif