forked from boostorg/exception
Fix and unit test for issue #37
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -138,7 +138,7 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
cd ../boost-root
|
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:
|
windows:
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <boost/core/demangle.hpp>
|
#include <boost/core/demangle.hpp>
|
||||||
#include <boost/current_function.hpp>
|
#include <boost/current_function.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS
|
#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS
|
||||||
#if __GNUC__*100+__GNUC_MINOR__>301
|
#if __GNUC__*100+__GNUC_MINOR__>301
|
||||||
@ -69,7 +70,7 @@ boost
|
|||||||
bool
|
bool
|
||||||
operator<( type_info_ const & a, type_info_ const & b )
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -86,9 +86,6 @@ boost
|
|||||||
if( info_.end()!=i )
|
if( info_.end()!=i )
|
||||||
{
|
{
|
||||||
shared_ptr<error_info_base> const & p = i->second;
|
shared_ptr<error_info_base> const & p = i->second;
|
||||||
#ifndef BOOST_NO_RTTI
|
|
||||||
BOOST_ASSERT( *BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==*ti.type_ );
|
|
||||||
#endif
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
return shared_ptr<error_info_base>();
|
return shared_ptr<error_info_base>();
|
||||||
|
@ -7,11 +7,6 @@
|
|||||||
|
|
||||||
import testing ;
|
import testing ;
|
||||||
|
|
||||||
project
|
|
||||||
: requirements
|
|
||||||
<link>static
|
|
||||||
;
|
|
||||||
|
|
||||||
#to_string
|
#to_string
|
||||||
|
|
||||||
run is_output_streamable_test.cpp ;
|
run is_output_streamable_test.cpp ;
|
||||||
@ -47,6 +42,9 @@ run errinfos_test.cpp : : : <exception-handling>on ;
|
|||||||
run exception_ptr_test.cpp/<define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR ../../thread/src/tss_null.cpp /boost/exception /boost//thread : : : <threading>multi <exception-handling>on : non_intrusive_exception_ptr_test ;
|
run exception_ptr_test.cpp/<define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR ../../thread/src/tss_null.cpp /boost/exception /boost//thread : : : <threading>multi <exception-handling>on : non_intrusive_exception_ptr_test ;
|
||||||
run exception_ptr_test.cpp ../../thread/src/tss_null.cpp /boost//thread : : : <threading>multi <exception-handling>on ;
|
run exception_ptr_test.cpp ../../thread/src/tss_null.cpp /boost//thread : : : <threading>multi <exception-handling>on ;
|
||||||
|
|
||||||
|
lib visibility_test_lib : visibility_test_lib.cpp : <visibility>hidden <exception-handling>on ;
|
||||||
|
run visibility_test.cpp visibility_test_lib/<link>shared : : : <visibility>hidden <exception-handling>on ;
|
||||||
|
|
||||||
compile-fail exception_fail.cpp ;
|
compile-fail exception_fail.cpp ;
|
||||||
compile-fail throw_exception_fail.cpp ;
|
compile-fail throw_exception_fail.cpp ;
|
||||||
compile-fail error_info_const_fail.cpp ;
|
compile-fail error_info_const_fail.cpp ;
|
||||||
|
32
test/visibility_test.cpp
Normal file
32
test/visibility_test.cpp
Normal file
@ -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 <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined( BOOST_NO_EXCEPTIONS )
|
||||||
|
# error This program requires exception handling.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "visibility_test_lib.hpp"
|
||||||
|
#include <boost/exception/get_error_info.hpp>
|
||||||
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
|
||||||
|
void BOOST_SYMBOL_IMPORT hidden_throw();
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
hidden_throw();
|
||||||
|
BOOST_TEST(false);
|
||||||
|
}
|
||||||
|
catch(
|
||||||
|
my_exception & e )
|
||||||
|
{
|
||||||
|
BOOST_TEST(boost::get_error_info<my_info>(e) && *boost::get_error_info<my_info>(e)==42);
|
||||||
|
}
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
9
test/visibility_test_lib.cpp
Normal file
9
test/visibility_test_lib.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include "visibility_test_lib.hpp"
|
||||||
|
#include <boost/throw_exception.hpp>
|
||||||
|
|
||||||
|
void
|
||||||
|
BOOST_SYMBOL_EXPORT
|
||||||
|
hidden_throw()
|
||||||
|
{
|
||||||
|
BOOST_THROW_EXCEPTION(my_exception() << my_info(42));
|
||||||
|
}
|
15
test/visibility_test_lib.hpp
Normal file
15
test/visibility_test_lib.hpp
Normal file
@ -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 <boost/exception/info.hpp>
|
||||||
|
|
||||||
|
typedef boost::error_info<struct my_info_, int> my_info;
|
||||||
|
|
||||||
|
struct BOOST_SYMBOL_VISIBLE my_exception: virtual std::exception, virtual boost::exception { };
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user