From 1a918009fd23693335f65b9d6c7803071a5f9fff Mon Sep 17 00:00:00 2001 From: Chris Glover Date: Thu, 29 Sep 2016 22:27:10 -0400 Subject: [PATCH 1/3] Fix comment. --- .../boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp b/include/boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp index 8164eda..6181df6 100644 --- a/include/boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp +++ b/include/boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_TYPE_INDEX_RUNTIME_CAST_DETAIL_RUNTIME_CAST_IMPL_HPP #define BOOST_TYPE_INDEX_RUNTIME_CAST_DETAIL_RUNTIME_CAST_IMPL_HPP -/// \file pointer_class.hpp +/// \file runtime_cast_impl.hpp /// \brief Contains the overload of boost::typeindex::runtime_cast for /// pointer types. /// From b61a7423b7b02cf877c8e0b9ca9e7673d5a6b2f3 Mon Sep 17 00:00:00 2001 From: Chris Glover Date: Thu, 29 Sep 2016 22:29:10 -0400 Subject: [PATCH 2/3] Update unit test to remove shared_ptr on compilers less than C++11. --- test/type_index_runtime_cast_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/type_index_runtime_cast_test.cpp b/test/type_index_runtime_cast_test.cpp index c64222a..7296f10 100644 --- a/test/type_index_runtime_cast_test.cpp +++ b/test/type_index_runtime_cast_test.cpp @@ -249,12 +249,14 @@ void boost_shared_ptr() void std_shared_ptr() { +#if defined(__cplusplus) && (__cplusplus >= 201103L) using namespace boost::typeindex; std::shared_ptr d = std::make_shared(); std::shared_ptr b = d; std::shared_ptr d2 = runtime_pointer_cast(b); BOOST_TEST_NE(d2, std::shared_ptr()); BOOST_TEST_EQ(d2->name, "single_derived"); +#endif } int main() { From 4459af9532f5d640515f5bcc4613c01a65059516 Mon Sep 17 00:00:00 2001 From: Chris Glover Date: Thu, 29 Sep 2016 22:29:35 -0400 Subject: [PATCH 3/3] FIx a unit test so that the NULL check happens before the dereference. --- test/type_index_runtime_cast_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/type_index_runtime_cast_test.cpp b/test/type_index_runtime_cast_test.cpp index 7296f10..397014e 100644 --- a/test/type_index_runtime_cast_test.cpp +++ b/test/type_index_runtime_cast_test.cpp @@ -233,8 +233,8 @@ void diamond_non_virtual() level1_a* l1a = &inst; base* b1 = l1a; level1_b* l1_b = runtime_cast(b1); - BOOST_TEST_EQ(l1_b->name, "level1_b"); BOOST_TEST_NE(l1_b, (level1_b*)NULL); + BOOST_TEST_EQ(l1_b->name, "level1_b"); } void boost_shared_ptr()