diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 46df5e0..27bb74b 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -215,6 +215,12 @@ run test_lib_typeid.cpp lib_typeid : : : static : test_lib_typeid_static ; run test_lib_typeid.cpp lib_typeid : : : shared off : test_lib_typeid_shared_no_rtti ; run test_lib_typeid.cpp lib_typeid : : : static off : test_lib_typeid_static_no_rtti ; +run test_lib_typeid2.cpp lib_typeid : : : shared : test_lib_typeid2_shared ; +run test_lib_typeid2.cpp lib_typeid : : : static : test_lib_typeid2_static ; + +run test_lib_typeid2.cpp lib_typeid : : : shared off : test_lib_typeid2_shared_no_rtti ; +run test_lib_typeid2.cpp lib_typeid : : : static off : test_lib_typeid2_static_no_rtti ; + run uncaught_exceptions.cpp : : : on ; run uncaught_exceptions_np.cpp diff --git a/test/lib_typeid.cpp b/test/lib_typeid.cpp index b07a393..80bdb2d 100644 --- a/test/lib_typeid.cpp +++ b/test/lib_typeid.cpp @@ -15,3 +15,12 @@ EXPORT boost::core::typeinfo const & get_typeid_int() { return BOOST_CORE_TYPEID( int ); } + +struct BOOST_SYMBOL_VISIBLE X +{ +}; + +EXPORT boost::core::typeinfo const & get_typeid_X() +{ + return BOOST_CORE_TYPEID( X ); +} diff --git a/test/test_lib_typeid2.cpp b/test/test_lib_typeid2.cpp new file mode 100644 index 0000000..583b2c1 --- /dev/null +++ b/test/test_lib_typeid2.cpp @@ -0,0 +1,34 @@ + +// Copyright 2018, 2021 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. + +#include +#include + +boost::core::typeinfo const & get_typeid_X(); + +struct BOOST_SYMBOL_VISIBLE X +{ +}; + +struct Y +{ +}; + +int main() +{ + boost::core::typeinfo const & tx = BOOST_CORE_TYPEID( X ); + boost::core::typeinfo const & ty = BOOST_CORE_TYPEID( Y ); + + boost::core::typeinfo const & tx2 = get_typeid_X(); + + BOOST_TEST( tx2 == tx ); + BOOST_TEST( tx2 != ty ); + + BOOST_TEST( !tx2.before( tx ) ); + BOOST_TEST( !tx.before( tx2 ) ); + + BOOST_TEST( tx2.before( ty ) != ty.before( tx2 ) ); + + return boost::report_errors(); +}