mirror of
https://github.com/boostorg/core.git
synced 2025-05-11 13:13:55 +00:00
Fix test to compare typeinfo
rather than its address
This commit is contained in:
parent
3c9c9603ad
commit
4dc12c59bd
@ -11,7 +11,7 @@
|
|||||||
# define EXPORT
|
# define EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXPORT boost::core::typeinfo const * get_typeid_int()
|
EXPORT boost::core::typeinfo const & get_typeid_int()
|
||||||
{
|
{
|
||||||
return &BOOST_CORE_TYPEID( int );
|
return BOOST_CORE_TYPEID( int );
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,22 @@
|
|||||||
#include <boost/core/typeinfo.hpp>
|
#include <boost/core/typeinfo.hpp>
|
||||||
#include <boost/core/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
boost::core::typeinfo const * get_typeid_int();
|
boost::core::typeinfo const & get_typeid_int();
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BOOST_TEST_EQ( get_typeid_int(), &BOOST_CORE_TYPEID( int ) );
|
boost::core::typeinfo const & ti = BOOST_CORE_TYPEID( int );
|
||||||
|
boost::core::typeinfo const & tf = BOOST_CORE_TYPEID( float );
|
||||||
|
|
||||||
|
boost::core::typeinfo const & ti2 = get_typeid_int();
|
||||||
|
|
||||||
|
BOOST_TEST( ti2 == ti );
|
||||||
|
BOOST_TEST( ti2 != tf );
|
||||||
|
|
||||||
|
BOOST_TEST( !ti2.before( ti ) );
|
||||||
|
BOOST_TEST( !ti.before( ti2 ) );
|
||||||
|
|
||||||
|
BOOST_TEST( ti2.before( tf ) != tf.before( ti2 ) );
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user