From 7df81354d5da8a17de7a038bbe98d56d3635bbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 20 Oct 2020 11:29:16 +0200 Subject: [PATCH] Avoid warning "conversions to arrays of unknown bound are only available with -std=c++2a..." when using -pedantic for GCC >= 10 --- include/boost/move/default_delete.hpp | 33 +++++++++++++++++-- .../move/detail/unique_ptr_meta_utils.hpp | 26 --------------- include/boost/move/unique_ptr.hpp | 10 +++--- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/include/boost/move/default_delete.hpp b/include/boost/move/default_delete.hpp index 31ae67a..275794e 100644 --- a/include/boost/move/default_delete.hpp +++ b/include/boost/move/default_delete.hpp @@ -112,6 +112,33 @@ void call_delete(T *p, is_array_del) delete p; } +template< class T, class U + , bool enable = def_del_compatible_cond< U, T>::value && + !move_upmu::is_array::value && + !move_upmu::is_same::type, void>::value && + !move_upmu::is_same::type, typename move_upmu::remove_cv::type>::value + > +struct missing_virtual_destructor_default_delete +{ static const bool value = !move_upmu::has_virtual_destructor::value; }; + +template +struct missing_virtual_destructor_default_delete +{ static const bool value = false; }; + +////////////////////////////////////// +// missing_virtual_destructor +////////////////////////////////////// + +template +struct missing_virtual_destructor +{ static const bool value = false; }; + +template +struct missing_virtual_destructor< ::boost::movelib::default_delete, U > + : missing_virtual_destructor_default_delete +{}; + + } //namespace move_upd { // @endcond @@ -163,7 +190,7 @@ struct default_delete { //If T is not an array type, U derives from T //and T has no virtual destructor, then you have a problem - BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor::value )); + BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor::value )); } //! Effects: Constructs a default_delete object from another default_delete object. @@ -178,7 +205,7 @@ struct default_delete { //If T is not an array type, U derives from T //and T has no virtual destructor, then you have a problem - BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor::value )); + BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor::value )); return *this; } @@ -198,7 +225,7 @@ struct default_delete BOOST_STATIC_ASSERT(sizeof(U) > 0); //If T is not an array type, U derives from T //and T has no virtual destructor, then you have a problem - BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor::value )); + BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor::value )); element_type * const p = static_cast(ptr); move_upd::call_delete(p, move_upd::is_array_del::value>()); } diff --git a/include/boost/move/detail/unique_ptr_meta_utils.hpp b/include/boost/move/detail/unique_ptr_meta_utils.hpp index 5f81eec..4c6aeb5 100644 --- a/include/boost/move/detail/unique_ptr_meta_utils.hpp +++ b/include/boost/move/detail/unique_ptr_meta_utils.hpp @@ -559,32 +559,6 @@ struct is_unary_function struct has_virtual_destructor{ static const bool value = true; }; #endif -////////////////////////////////////// -// missing_virtual_destructor -////////////////////////////////////// - -template< class T, class U - , bool enable = is_convertible< U*, T*>::value && - !is_array::value && - !is_same::type, void>::value && - !is_same::type, typename remove_cv::type>::value - > -struct missing_virtual_destructor_default_delete -{ static const bool value = !has_virtual_destructor::value; }; - -template -struct missing_virtual_destructor_default_delete -{ static const bool value = false; }; - -template -struct missing_virtual_destructor -{ static const bool value = false; }; - -template -struct missing_virtual_destructor< ::boost::movelib::default_delete, U > - : missing_virtual_destructor_default_delete -{}; - } //namespace move_upmu { } //namespace boost { diff --git a/include/boost/move/unique_ptr.hpp b/include/boost/move/unique_ptr.hpp index 2d794e8..5f9a107 100644 --- a/include/boost/move/unique_ptr.hpp +++ b/include/boost/move/unique_ptr.hpp @@ -430,7 +430,7 @@ class unique_ptr { //If T is not an array type, element_type_t derives from T //it uses the default deleter and T has no virtual destructor, then you have a problem - BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor + BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor ::type>::value )); //If this constructor is instantiated with a pointer type or reference type //for the template argument D, the program is ill-formed. @@ -468,7 +468,7 @@ class unique_ptr { //If T is not an array type, element_type_t derives from T //it uses the default deleter and T has no virtual destructor, then you have a problem - BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor + BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor ::type>::value )); } @@ -506,7 +506,7 @@ class unique_ptr { //If T is not an array type, element_type_t derives from T //it uses the default deleter and T has no virtual destructor, then you have a problem - BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor + BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor ::type>::value )); } @@ -553,7 +553,7 @@ class unique_ptr { //If T is not an array type, U derives from T //it uses the default deleter and T has no virtual destructor, then you have a problem - BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor + BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor ::pointer>::value )); } @@ -711,7 +711,7 @@ class unique_ptr { //If T is not an array type, element_type_t derives from T //it uses the default deleter and T has no virtual destructor, then you have a problem - BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor + BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor ::type>::value )); pointer tmp = m_data.m_p; m_data.m_p = p;