From 2837f3b9c58b5fe6498cff450fa86ed08eca51fb Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 11 Sep 2018 20:18:13 +0300 Subject: [PATCH] g++ 4.5 and earlier do not support unrestricted unions --- include/boost/endian/arithmetic.hpp | 4 +++- include/boost/endian/buffers.hpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/endian/arithmetic.hpp b/include/boost/endian/arithmetic.hpp index 6bad70f..38e8bdc 100644 --- a/include/boost/endian/arithmetic.hpp +++ b/include/boost/endian/arithmetic.hpp @@ -35,6 +35,7 @@ #endif #include +#include #include #include #include @@ -58,7 +59,8 @@ # define BOOST_ENDIAN_DEFAULT_CONSTRUCT = default; // C++0x # endif -# if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && defined(BOOST_ENDIAN_FORCE_PODNESS) +// g++ pre-4.6 does not support unrestricted unions, but we have no Config macro for that +# if (defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || BOOST_WORKAROUND(BOOST_GCC, < 40600)) && defined(BOOST_ENDIAN_FORCE_PODNESS) # define BOOST_ENDIAN_NO_CTORS # endif diff --git a/include/boost/endian/buffers.hpp b/include/boost/endian/buffers.hpp index dd0e11e..467fd59 100644 --- a/include/boost/endian/buffers.hpp +++ b/include/boost/endian/buffers.hpp @@ -35,6 +35,7 @@ #endif #include +#include #include #include #include @@ -59,7 +60,8 @@ # define BOOST_ENDIAN_DEFAULT_CONSTRUCT = default; // C++0x # endif -# if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && defined(BOOST_ENDIAN_FORCE_PODNESS) +// g++ pre-4.6 does not support unrestricted unions, but we have no Config macro for that +# if (defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || BOOST_WORKAROUND(BOOST_GCC, < 40600)) && defined(BOOST_ENDIAN_FORCE_PODNESS) # define BOOST_ENDIAN_NO_CTORS # endif