Tests to reproduce the track issue 13621

This commit is contained in:
Antony Polukhin
2018-07-28 17:44:17 +03:00
parent c2caa340ab
commit c9c1412a05
3 changed files with 33 additions and 1 deletions

View File

@ -48,6 +48,7 @@ test-suite type_index
[ run testing_crossmodule.cpp test_lib_nortti : : : <rtti>off $(norttidefines) : testing_crossmodule_no_rtti ]
[ run testing_crossmodule_anonymous.cpp test_lib_anonymous_rtti : : : <test-info>always_show_run_output ]
[ run compare_ctti_stl.cpp ]
[ run track_13621.cpp ]
[ compile-fail type_index_test_ctti_copy_fail.cpp ]
[ compile-fail type_index_test_ctti_construct_fail.cpp ]

View File

@ -1,5 +1,5 @@
//
// Copyright Antony Polukhin, 2012-2015.
// Copyright Antony Polukhin, 2012-2018.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@ -17,6 +17,11 @@ namespace user_defined_namespace {
class user_defined_class {};
}
class empty
{
};
int main()
{
using namespace boost::typeindex;
@ -31,6 +36,9 @@ int main()
<< ctti_type_index::type_id<user_defined_namespace::user_defined_class>() << '\n';
std::cout << "empty:"
<< ctti_type_index::type_id<empty>() << '\n';
return 0;
}

23
test/track_13621.cpp Normal file
View File

@ -0,0 +1,23 @@
//
// Copyright Antony Polukhin, 2018.
//
// 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/type_index/ctti_type_index.hpp>
#include <string>
#include <boost/core/lightweight_test.hpp>
class empty
{
};
int main()
{
std::string name = boost::typeindex::ctti_type_index::type_id<empty>().pretty_name();
BOOST_TEST(name.find("empty") != std::string::npos);
return boost::report_errors();
}