mirror of
https://github.com/boostorg/static_assert.git
synced 2025-07-23 17:27:24 +02:00
cast integral constant expression to bool to fix some compiler warnings and some compiler bugs.
[SVN r10230]
This commit is contained in:
@ -58,21 +58,21 @@ template<int x> struct static_assert_test{};
|
|||||||
#ifndef BOOST_MSVC
|
#ifndef BOOST_MSVC
|
||||||
#define BOOST_STATIC_ASSERT( B ) \
|
#define BOOST_STATIC_ASSERT( B ) \
|
||||||
typedef ::boost::static_assert_test<\
|
typedef ::boost::static_assert_test<\
|
||||||
sizeof(::boost::STATIC_ASSERTION_FAILURE< ( B ) >)>\
|
sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\
|
||||||
BOOST_ASSERT_JOIN(boost_static_assert_typedef_, __LINE__)
|
BOOST_ASSERT_JOIN(boost_static_assert_typedef_, __LINE__)
|
||||||
#else
|
#else
|
||||||
// __LINE__ macro broken when -ZI is used see Q199057
|
// __LINE__ macro broken when -ZI is used see Q199057
|
||||||
// fortunately MSVC ignores duplicate typedef's.
|
// fortunately MSVC ignores duplicate typedef's.
|
||||||
#define BOOST_STATIC_ASSERT( B ) \
|
#define BOOST_STATIC_ASSERT( B ) \
|
||||||
typedef ::boost::static_assert_test<\
|
typedef ::boost::static_assert_test<\
|
||||||
sizeof(::boost::STATIC_ASSERTION_FAILURE< ( B ) >)\
|
sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)\
|
||||||
> boost_static_assert_typedef_
|
> boost_static_assert_typedef_
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// alternative enum based implementation:
|
// alternative enum based implementation:
|
||||||
#define BOOST_STATIC_ASSERT( B ) \
|
#define BOOST_STATIC_ASSERT( B ) \
|
||||||
enum { BOOST_ASSERT_JOIN(boost_static_assert_enum_, __LINE__) \
|
enum { BOOST_ASSERT_JOIN(boost_static_assert_enum_, __LINE__) \
|
||||||
= sizeof(::boost::STATIC_ASSERTION_FAILURE< ( B ) >) }
|
= sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user