mirror of
https://github.com/boostorg/core.git
synced 2025-07-31 13:27:29 +02:00
Avoid -Wsign-conversion warning in checked_delete.hpp
This commit is contained in:
@@ -30,16 +30,33 @@ namespace boost
|
|||||||
|
|
||||||
template<class T> inline void checked_delete(T * x) BOOST_NOEXCEPT
|
template<class T> inline void checked_delete(T * x) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
// intentionally complex - simplification causes regressions
|
#if defined(__cpp_static_assert) && __cpp_static_assert >= 200410L
|
||||||
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
|
|
||||||
|
static_assert( sizeof(T) != 0, "Type must be complete" );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
typedef char type_must_be_complete[ sizeof(T) ];
|
||||||
(void) sizeof(type_must_be_complete);
|
(void) sizeof(type_must_be_complete);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
delete x;
|
delete x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline void checked_array_delete(T * x) BOOST_NOEXCEPT
|
template<class T> inline void checked_array_delete(T * x) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
|
#if defined(__cpp_static_assert) && __cpp_static_assert >= 200410L
|
||||||
|
|
||||||
|
static_assert( sizeof(T) != 0, "Type must be complete" );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
typedef char type_must_be_complete[ sizeof(T) ];
|
||||||
(void) sizeof(type_must_be_complete);
|
(void) sizeof(type_must_be_complete);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
delete [] x;
|
delete [] x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user