mirror of
https://github.com/boostorg/core.git
synced 2025-05-11 05:07:39 +00:00
Add test for typeid(struct X) across libraries
This commit is contained in:
parent
1c43651533
commit
2e5ecbe6f6
@ -215,6 +215,12 @@ run test_lib_typeid.cpp lib_typeid : : : <link>static : test_lib_typeid_static ;
|
|||||||
run test_lib_typeid.cpp lib_typeid : : : <link>shared <rtti>off : test_lib_typeid_shared_no_rtti ;
|
run test_lib_typeid.cpp lib_typeid : : : <link>shared <rtti>off : test_lib_typeid_shared_no_rtti ;
|
||||||
run test_lib_typeid.cpp lib_typeid : : : <link>static <rtti>off : test_lib_typeid_static_no_rtti ;
|
run test_lib_typeid.cpp lib_typeid : : : <link>static <rtti>off : test_lib_typeid_static_no_rtti ;
|
||||||
|
|
||||||
|
run test_lib_typeid2.cpp lib_typeid : : : <link>shared : test_lib_typeid2_shared ;
|
||||||
|
run test_lib_typeid2.cpp lib_typeid : : : <link>static : test_lib_typeid2_static ;
|
||||||
|
|
||||||
|
run test_lib_typeid2.cpp lib_typeid : : : <link>shared <rtti>off : test_lib_typeid2_shared_no_rtti ;
|
||||||
|
run test_lib_typeid2.cpp lib_typeid : : : <link>static <rtti>off : test_lib_typeid2_static_no_rtti ;
|
||||||
|
|
||||||
run uncaught_exceptions.cpp
|
run uncaught_exceptions.cpp
|
||||||
: : : <exception-handling>on ;
|
: : : <exception-handling>on ;
|
||||||
run uncaught_exceptions_np.cpp
|
run uncaught_exceptions_np.cpp
|
||||||
|
@ -15,3 +15,12 @@ EXPORT boost::core::typeinfo const & get_typeid_int()
|
|||||||
{
|
{
|
||||||
return BOOST_CORE_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 );
|
||||||
|
}
|
||||||
|
34
test/test_lib_typeid2.cpp
Normal file
34
test/test_lib_typeid2.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
// Copyright 2018, 2021 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
|
#include <boost/core/typeinfo.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user