
BOOST_STATIC_ASSERT predated C++0x static_assert, so it doesn't take advantage of static_assert's message argument when static_assert is available. It would break too much code to change BOOST_STATIC_ASSERT, but we can add a new macro that does take advantage of C++0x static_assert if available. After adding this to <boost/static_assert.hpp>: + #ifndef BOOST_NO_STATIC_ASSERT + # define BOOST_STATIC_ASSERT_MSG( B, Msg ) static_assert(B, Msg) + #else + # define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B ) + #endif This test program: #include <boost/static_assert.hpp> int main() { BOOST_STATIC_ASSERT_MSG( true, "should never fire" ); BOOST_STATIC_ASSERT_MSG( false, "should always fire" ); return 0; } Compiling with VC++ 10, which supports static_assert, produced: temp.cpp(7) : error C2338: should always fire Compiling with VC++ 9, which does not support static_assert, produced: temp.cpp(7) : error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>' with [ x=false ] Comments? --Beman