From aa1a9ef2d71b0d41316b467f50ea2002a3520f9b Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 25 Sep 2024 20:15:31 +0300 Subject: [PATCH] Use static_assert in sp_assert_convertible --- include/boost/smart_ptr/shared_ptr.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/boost/smart_ptr/shared_ptr.hpp b/include/boost/smart_ptr/shared_ptr.hpp index d41a203..a1adfcf 100644 --- a/include/boost/smart_ptr/shared_ptr.hpp +++ b/include/boost/smart_ptr/shared_ptr.hpp @@ -195,9 +195,7 @@ inline void sp_enable_shared_from_this( ... ) template< class Y, class T > inline void sp_assert_convertible() BOOST_SP_NOEXCEPT { - // static_assert( sp_convertible< Y, T >::value ); - typedef char tmp[ sp_convertible< Y, T >::value? 1: -1 ]; - (void)sizeof( tmp ); + static_assert( sp_convertible< Y, T >::value, "incompatible pointer type" ); } // pointer constructor helper