From 1c8190cc62518fe7f96ec5567cd57c30f06dd362 Mon Sep 17 00:00:00 2001 From: klemens-morgenstern Date: Sat, 13 Feb 2016 18:52:29 +0100 Subject: [PATCH 1/3] FIxed space removal I only tested that with templates, the space removal was too much. I'll add a test for that, sry. --- include/boost/type_index/detail/compile_time_type_info.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/type_index/detail/compile_time_type_info.hpp b/include/boost/type_index/detail/compile_time_type_info.hpp index acc4dbe..89e1a0b 100644 --- a/include/boost/type_index/detail/compile_time_type_info.hpp +++ b/include/boost/type_index/detail/compile_time_type_info.hpp @@ -46,8 +46,8 @@ // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void)") - 1 BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 10, false, "") #else - // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(" >::n(void) noexcept") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 20, false, "") + // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void) noexcept") - 1 + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 19, false, "") #endif #elif defined(__clang__) && defined(__APPLE__) // Someone made __clang_major__ equal to LLVM version rather than compiler version From 5de7f5def65f264398dbd1dc802de7481acf8b77 Mon Sep 17 00:00:00 2001 From: klemens-morgenstern Date: Sat, 13 Feb 2016 19:08:59 +0100 Subject: [PATCH 2/3] added comparison test --- test/Jamfile.v2 | 1 + test/compare_ctti_stl.cpp | 67 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 test/compare_ctti_stl.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index a9f1e85..a4550d1 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -45,6 +45,7 @@ test-suite type_index [ run testing_crossmodule.cpp test_lib_rtti ] [ run testing_crossmodule.cpp test_lib_nortti : : : off $(norttidefines) : testing_crossmodule_no_rtti ] [ run testing_crossmodule_anonymous.cpp test_lib_anonymous_rtti ] + [ run compare_ctti_stl.cpp ] [ compile-fail type_index_test_ctti_copy_fail.cpp ] [ compile-fail type_index_test_ctti_construct_fail.cpp ] diff --git a/test/compare_ctti_stl.cpp b/test/compare_ctti_stl.cpp new file mode 100644 index 0000000..3388ffd --- /dev/null +++ b/test/compare_ctti_stl.cpp @@ -0,0 +1,67 @@ +// +// Copyright Klemens Morgenstern, 2012-2015. +// +// 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 + + +namespace my_namespace1 { + class my_class{}; +} + + +namespace my_namespace2 { + class my_class{}; +} + +namespace my_namespace3 +{ +template +struct my_template {}; + +} + +#if !defined( BOOST_NO_RTTI ) + +template +void compare() +{ + typedef boost::typeindex::ctti_type_index ctti; + typedef boost::typeindex::stl_type_index stl; + BOOST_TEST_EQ( + ctti::type_id().pretty_name(), + stl::type_id().pretty_name() + ); +} + + +int main() +{ + compare(); + compare(); + compare(); + compare(); + compare(); + + compare >(); + + + return boost::report_errors(); +} + +#else + +int main() +{ + return 0; +} + +#endif + From b9db4620912f7ae7faa011504e0d3c81fa813449 Mon Sep 17 00:00:00 2001 From: klemens-morgenstern Date: Sat, 13 Feb 2016 19:11:04 +0100 Subject: [PATCH 3/3] fixed length with noexcept --- include/boost/type_index/detail/compile_time_type_info.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/type_index/detail/compile_time_type_info.hpp b/include/boost/type_index/detail/compile_time_type_info.hpp index acc4dbe..89e1a0b 100644 --- a/include/boost/type_index/detail/compile_time_type_info.hpp +++ b/include/boost/type_index/detail/compile_time_type_info.hpp @@ -46,8 +46,8 @@ // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void)") - 1 BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 10, false, "") #else - // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(" >::n(void) noexcept") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 20, false, "") + // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void) noexcept") - 1 + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 19, false, "") #endif #elif defined(__clang__) && defined(__APPLE__) // Someone made __clang_major__ equal to LLVM version rather than compiler version