From 5114ca9d357f3387d1d8376f53c76825cfe246ff Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Tue, 7 Apr 2015 11:09:47 -0600 Subject: [PATCH] Fix double pointer cast test --- include/chaiscript/dispatchkit/boxed_cast_helper.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/chaiscript/dispatchkit/boxed_cast_helper.hpp b/include/chaiscript/dispatchkit/boxed_cast_helper.hpp index 69cfc7c..c218d30 100644 --- a/include/chaiscript/dispatchkit/boxed_cast_helper.hpp +++ b/include/chaiscript/dispatchkit/boxed_cast_helper.hpp @@ -81,16 +81,17 @@ namespace chaiscript typedef Result * Result_Type; static Result_Type cast(const Boxed_Value &ob, const Type_Conversions *) { - if (!ob.get_type_info().is_const() && ob.get_type_info().bare_equal_type_info(typeid(Result))) + if (ob.is_ref()) { - return static_cast(throw_if_null(ob.get_ptr())); + return &(ob.get().cast >()).get(); } else { - throw chaiscript::detail::exception::bad_any_cast(); + return (ob.get().cast >()).get(); } } }; + /// Cast_Helper_Inner for casting to a & type template struct Cast_Helper_Inner