From c9c1412a05f942958b296aa69fc4f89831aa7aab Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Sat, 28 Jul 2018 17:44:17 +0300 Subject: [PATCH] Tests to reproduce the track issue 13621 --- test/Jamfile.v2 | 1 + test/ctti_print_name.cpp | 10 +++++++++- test/track_13621.cpp | 23 +++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 test/track_13621.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index fc5c92a..5b06829 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -48,6 +48,7 @@ test-suite type_index [ run testing_crossmodule.cpp test_lib_nortti : : : off $(norttidefines) : testing_crossmodule_no_rtti ] [ run testing_crossmodule_anonymous.cpp test_lib_anonymous_rtti : : : 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 ] diff --git a/test/ctti_print_name.cpp b/test/ctti_print_name.cpp index 34f03d0..acfaaab 100644 --- a/test/ctti_print_name.cpp +++ b/test/ctti_print_name.cpp @@ -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() << '\n'; + std::cout << "empty:" + << ctti_type_index::type_id() << '\n'; + return 0; } diff --git a/test/track_13621.cpp b/test/track_13621.cpp new file mode 100644 index 0000000..1c433b4 --- /dev/null +++ b/test/track_13621.cpp @@ -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 +#include + +#include + +class empty +{ +}; + +int main() +{ + std::string name = boost::typeindex::ctti_type_index::type_id().pretty_name(); + BOOST_TEST(name.find("empty") != std::string::npos); + return boost::report_errors(); +} +