Fix BOOST_MPL_ASSERT_MSG for VC++8

The struct member function inside BOOST_MPL_ASSERT_MSG_IMPL was causing
multiple definitions of the same symbol when used inside e.g. template
functions.

An example of where this is a big issue is in the boost/geometry library
where you currently only can call each function once for each geometry
or you get hit by the multiple definitions linking error.

This fix* works around the issue by gracefully degrading to
BOOST_STATIC_ASSERT_MSG instead of failing during linking.
This commit is contained in:
Robin Lindén
2018-08-13 20:10:57 +02:00
parent 42c794ad42
commit e44b2ae761

View File

@@ -443,8 +443,16 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
/**/
#endif
#define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
// Work around BOOST_MPL_ASSERT_MSG_IMPL generating multiple definition linker errors on VC++8.
#if defined(BOOST_MSVC) && BOOST_MSVC < 1500
# include <boost/static_assert.hpp>
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
BOOST_STATIC_ASSERT_MSG( c, #msg ) \
/**/
#else
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
BOOST_MPL_ASSERT_MSG_IMPL( BOOST_MPL_AUX_PP_COUNTER(), c, msg, types_ ) \
/**/
#endif
#endif // BOOST_MPL_ASSERT_HPP_INCLUDED