diff --git a/include/boost/openmethod/shared_ptr.hpp b/include/boost/openmethod/shared_ptr.hpp index c758c5c..06c23ba 100644 --- a/include/boost/openmethod/shared_ptr.hpp +++ b/include/boost/openmethod/shared_ptr.hpp @@ -103,7 +103,8 @@ struct virtual_traits, Policy> { check_cast(); - if constexpr (detail::requires_dynamic_cast) { + if constexpr (detail::requires_dynamic_cast< + Class*, typename Other::element_type*>) { return std::dynamic_pointer_cast< typename shared_ptr_traits::virtual_type>(obj); } else {