From e44b2ae761540776f09c83021c11253898029d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Lind=C3=A9n?= Date: Mon, 13 Aug 2018 20:10:57 +0200 Subject: [PATCH] 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. --- include/boost/mpl/assert.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/boost/mpl/assert.hpp b/include/boost/mpl/assert.hpp index e41b583..baf43e0 100644 --- a/include/boost/mpl/assert.hpp +++ b/include/boost/mpl/assert.hpp @@ -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 +# 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