From 1029ee8032975dd49fb35bbf68956064f9dfe976 Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Mon, 16 Sep 2002 01:19:05 +0000 Subject: [PATCH] Intel C++ fix [SVN r15351] --- include/boost/static_assert.hpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index 4ba29d7..b28a55c 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -28,7 +28,7 @@ namespace boost{ // HP aCC cannot deal with missing names for template value parameters template struct STATIC_ASSERTION_FAILURE; -template <> struct STATIC_ASSERTION_FAILURE{}; +template <> struct STATIC_ASSERTION_FAILURE { enum { value = 1 }; }; // HP aCC cannot deal with missing names for template value parameters template struct static_assert_test{}; @@ -58,19 +58,28 @@ template struct static_assert_test{}; // when used inside integral constant expressions. // #if !defined(BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS) && !defined(__MWERKS__) -#ifndef BOOST_MSVC -#define BOOST_STATIC_ASSERT( B ) \ - typedef ::boost::static_assert_test<\ - sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\ - BOOST_JOIN(boost_static_assert_typedef_, __LINE__) -#else + +#if defined(BOOST_MSVC) // __LINE__ macro broken when -ZI is used see Q199057 // fortunately MSVC ignores duplicate typedef's. #define BOOST_STATIC_ASSERT( B ) \ typedef ::boost::static_assert_test<\ sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)\ > boost_static_assert_typedef_ +#elif defined(BOOST_INTEL_CXX_VERSION) +// agurt 15/sep/02: a special care is needed to force Intel C++ issue an error +// instead of warning in case of failure +# define BOOST_STATIC_ASSERT( B ) \ + typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \ + [ ::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >::value ] +#else +// generic version +#define BOOST_STATIC_ASSERT( B ) \ + typedef ::boost::static_assert_test<\ + sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\ + BOOST_JOIN(boost_static_assert_typedef_, __LINE__) #endif + #else // alternative enum based implementation: #define BOOST_STATIC_ASSERT( B ) \ @@ -80,7 +89,3 @@ template struct static_assert_test{}; #endif // BOOST_STATIC_ASSERT_HPP - - - -