From 7f9a618b8c461d71580f8c8de397d934b6000492 Mon Sep 17 00:00:00 2001 From: Tanzinul Islam Date: Fri, 25 Oct 2019 15:18:24 +0100 Subject: [PATCH] Fix BOOST_STATIC_ASSERT with template arguments a2025a932 introduced a `BOOST_STATIC_ASSERT`-check with a template argument list. This causes a compilation error in a pre-C++11 compiler without support for variadic arguments (i.e. if `BOOST_NO_CXX11_VARIADIC_MACROS` is set). For example: $ echo '#include ' > test.cpp $ g++ -c -std=c++03 -DBOOST_NO_CXX11_VARIADIC_MACROS -I/path/to/boost test.cpp results in: ``` In file included from /path/to/boost/boost/endian/detail/endian_store.hpp:9, from /path/to/boost/boost/endian/buffers.hpp:30, from test.cpp:1: /path/to/boost/boost/endian/detail/endian_reverse.hpp:111:76: error: macro "BOOST_STATIC_ASSERT" passed 2 arguments, but takes just 1 111 | BOOST_STATIC_ASSERT( is_integral::value && !is_same::value ); | ^ In file included from /path/to/boost/boost/endian/detail/endian_reverse.hpp:13, from /path/to/boost/boost/endian/detail/endian_store.hpp:9, from /path/to/boost/boost/endian/buffers.hpp:30, from test.cpp:1: /path/to/boost/boost/static_assert.hpp:157: note: macro "BOOST_STATIC_ASSERT" defined here 157 | # define BOOST_STATIC_ASSERT( B ) \ | ``` --- include/boost/endian/detail/endian_reverse.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/endian/detail/endian_reverse.hpp b/include/boost/endian/detail/endian_reverse.hpp index 4fd71bb..88fcf20 100644 --- a/include/boost/endian/detail/endian_reverse.hpp +++ b/include/boost/endian/detail/endian_reverse.hpp @@ -108,7 +108,7 @@ inline uint128_type BOOST_ENDIAN_CONSTEXPR endian_reverse_impl( uint128_type x ) template inline BOOST_CONSTEXPR T endian_reverse( T x ) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT( is_integral::value && !is_same::value ); + BOOST_STATIC_ASSERT( is_integral::value && !(is_same::value) ); typedef typename detail::integral_by_size< sizeof(T) >::type uintN_t;