mirror of
https://github.com/boostorg/core.git
synced 2025-05-09 14:57:46 +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
|
||||
{
|
||||
// intentionally complex - simplification causes regressions
|
||||
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);
|
||||
|
||||
#endif
|
||||
|
||||
delete x;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
#endif
|
||||
|
||||
delete [] x;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user