From 24f527d401ee348438e8a5f591be5ea130b9df2e Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Sun, 2 Aug 2015 21:58:20 +0900 Subject: [PATCH 1/2] Use BOOST_CONSTEXPR_OR_CONST instead. Older GCC cannot specify both of const and constexpr to variable decl. Partially fix #11517 --- include/boost/fusion/container/generation/ignore.hpp | 2 +- include/boost/fusion/support/unused.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/fusion/container/generation/ignore.hpp b/include/boost/fusion/container/generation/ignore.hpp index 15ce15d4..889f17d2 100644 --- a/include/boost/fusion/container/generation/ignore.hpp +++ b/include/boost/fusion/container/generation/ignore.hpp @@ -27,7 +27,7 @@ namespace boost { namespace fusion } // "ignore" allows tuple positions to be ignored when using "tie". - BOOST_CONSTEXPR detail::swallow_assign const ignore = detail::swallow_assign(); + BOOST_CONSTEXPR_OR_CONST detail::swallow_assign ignore = detail::swallow_assign(); }} #endif diff --git a/include/boost/fusion/support/unused.hpp b/include/boost/fusion/support/unused.hpp index 4bbe24e8..7e2a6eee 100644 --- a/include/boost/fusion/support/unused.hpp +++ b/include/boost/fusion/support/unused.hpp @@ -64,7 +64,7 @@ namespace boost { namespace fusion } }; - BOOST_CONSTEXPR unused_type const unused = unused_type(); + BOOST_CONSTEXPR_OR_CONST unused_type unused = unused_type(); namespace detail { From 8242c688e7965c66edba806b000bcf3ec7642312 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Mon, 3 Aug 2015 00:03:40 +0900 Subject: [PATCH 2/2] Older GCC doesn't accept use of `this` in constexpr. Fix #11517 --- include/boost/fusion/container/generation/ignore.hpp | 4 +++- include/boost/fusion/support/config.hpp | 8 ++++++++ include/boost/fusion/support/unused.hpp | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/boost/fusion/container/generation/ignore.hpp b/include/boost/fusion/container/generation/ignore.hpp index 889f17d2..78196632 100644 --- a/include/boost/fusion/container/generation/ignore.hpp +++ b/include/boost/fusion/container/generation/ignore.hpp @@ -9,6 +9,8 @@ #if !defined(FUSION_IGNORE_07192005_0329) #define FUSION_IGNORE_07192005_0329 +#include + namespace boost { namespace fusion { // Swallows any assignment (by Doug Gregor) @@ -17,7 +19,7 @@ namespace boost { namespace fusion struct swallow_assign { template - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + BOOST_FUSION_CONSTEXPR_THIS BOOST_FUSION_GPU_ENABLED swallow_assign const& operator=(const T&) const { diff --git a/include/boost/fusion/support/config.hpp b/include/boost/fusion/support/config.hpp index 1ce042a8..23554531 100644 --- a/include/boost/fusion/support/config.hpp +++ b/include/boost/fusion/support/config.hpp @@ -88,4 +88,12 @@ namespace std } #endif + +// Workaround for older GCC that doesn't accept `this` in constexpr. +#if BOOST_WORKAROUND(BOOST_GCC, < 40700) +#define BOOST_FUSION_CONSTEXPR_THIS +#else +#define BOOST_FUSION_CONSTEXPR_THIS BOOST_CONSTEXPR +#endif + #endif diff --git a/include/boost/fusion/support/unused.hpp b/include/boost/fusion/support/unused.hpp index 7e2a6eee..964839ab 100644 --- a/include/boost/fusion/support/unused.hpp +++ b/include/boost/fusion/support/unused.hpp @@ -34,7 +34,7 @@ namespace boost { namespace fusion } template - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + BOOST_FUSION_CONSTEXPR_THIS BOOST_FUSION_GPU_ENABLED unused_type const& operator=(T const&) const BOOST_NOEXCEPT { @@ -49,7 +49,7 @@ namespace boost { namespace fusion return *this; } - BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + BOOST_FUSION_CONSTEXPR_THIS BOOST_FUSION_GPU_ENABLED unused_type const& operator=(unused_type const&) const BOOST_NOEXCEPT {