Skip to content

Commit

Permalink
Tests to reproduce the track issue 13621
Browse files Browse the repository at this point in the history
  • Loading branch information
apolukhin committed Jul 28, 2018
1 parent c2caa34 commit c9c1412
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down
10 changes: 9 additions & 1 deletion test/ctti_print_name.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,6 +17,11 @@ namespace user_defined_namespace {
class user_defined_class {};
}

class empty
{
};


int main()
{
using namespace boost::typeindex;
Expand All @@ -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 changes: 23 additions & 0 deletions test/track_13621.cpp
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit c9c1412

Please sign in to comment.