forked from boostorg/move
Avoid warning "conversions to arrays of unknown bound are only available with -std=c++2a..." when using -pedantic for GCC >= 10
This commit is contained in:
@ -112,6 +112,33 @@ void call_delete(T *p, is_array_del<false>)
|
||||
delete p;
|
||||
}
|
||||
|
||||
template< class T, class U
|
||||
, bool enable = def_del_compatible_cond< U, T>::value &&
|
||||
!move_upmu::is_array<T>::value &&
|
||||
!move_upmu::is_same<typename move_upmu::remove_cv<T>::type, void>::value &&
|
||||
!move_upmu::is_same<typename move_upmu::remove_cv<U>::type, typename move_upmu::remove_cv<T>::type>::value
|
||||
>
|
||||
struct missing_virtual_destructor_default_delete
|
||||
{ static const bool value = !move_upmu::has_virtual_destructor<T>::value; };
|
||||
|
||||
template<class T, class U>
|
||||
struct missing_virtual_destructor_default_delete<T, U, false>
|
||||
{ static const bool value = false; };
|
||||
|
||||
//////////////////////////////////////
|
||||
// missing_virtual_destructor
|
||||
//////////////////////////////////////
|
||||
|
||||
template<class Deleter, class U>
|
||||
struct missing_virtual_destructor
|
||||
{ static const bool value = false; };
|
||||
|
||||
template<class T, class U>
|
||||
struct missing_virtual_destructor< ::boost::movelib::default_delete<T>, U >
|
||||
: missing_virtual_destructor_default_delete<T, U>
|
||||
{};
|
||||
|
||||
|
||||
} //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<default_delete, U>::value ));
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor<default_delete, U>::value ));
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a default_delete object from another <tt>default_delete<U></tt> 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<default_delete, U>::value ));
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor<default_delete, U>::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<default_delete, U>::value ));
|
||||
BOOST_STATIC_ASSERT(( !bmupd::missing_virtual_destructor<default_delete, U>::value ));
|
||||
element_type * const p = static_cast<element_type*>(ptr);
|
||||
move_upd::call_delete(p, move_upd::is_array_del<bmupmu::is_array<T>::value>());
|
||||
}
|
||||
|
@ -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<T>::value &&
|
||||
!is_same<typename remove_cv<T>::type, void>::value &&
|
||||
!is_same<typename remove_cv<U>::type, typename remove_cv<T>::type>::value
|
||||
>
|
||||
struct missing_virtual_destructor_default_delete
|
||||
{ static const bool value = !has_virtual_destructor<T>::value; };
|
||||
|
||||
template<class T, class U>
|
||||
struct missing_virtual_destructor_default_delete<T, U, false>
|
||||
{ static const bool value = false; };
|
||||
|
||||
template<class Deleter, class U>
|
||||
struct missing_virtual_destructor
|
||||
{ static const bool value = false; };
|
||||
|
||||
template<class T, class U>
|
||||
struct missing_virtual_destructor< ::boost::movelib::default_delete<T>, U >
|
||||
: missing_virtual_destructor_default_delete<T, U>
|
||||
{};
|
||||
|
||||
} //namespace move_upmu {
|
||||
} //namespace boost {
|
||||
|
||||
|
@ -430,7 +430,7 @@ class unique_ptr
|
||||
{
|
||||
//If T is not an array type, element_type_t<Pointer> 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
|
||||
<D, typename bmupd::get_element_type<Pointer>::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<Pointer> 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
|
||||
<D, typename bmupd::get_element_type<Pointer>::type>::value ));
|
||||
}
|
||||
|
||||
@ -506,7 +506,7 @@ class unique_ptr
|
||||
{
|
||||
//If T is not an array type, element_type_t<Pointer> 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
|
||||
<D, typename bmupd::get_element_type<Pointer>::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
|
||||
<D, typename unique_ptr<U, E>::pointer>::value ));
|
||||
}
|
||||
|
||||
@ -711,7 +711,7 @@ class unique_ptr
|
||||
{
|
||||
//If T is not an array type, element_type_t<Pointer> 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
|
||||
<D, typename bmupd::get_element_type<Pointer>::type>::value ));
|
||||
pointer tmp = m_data.m_p;
|
||||
m_data.m_p = p;
|
||||
|
Reference in New Issue
Block a user