mirror of
https://github.com/boostorg/core.git
synced 2025-05-09 23:03:54 +00:00
Avoid -Wsign-conversion warning in checked_delete.hpp
This commit is contained in:
parent
66890c3f3d
commit
216999e552
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user