From b7ad896707af20a06110b23edfd60a977af47fe1 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 7 Aug 2018 22:59:25 +0300 Subject: [PATCH] explicit_operator_bool: under g++ 4.6 the operator can't be constexpr --- include/boost/core/explicit_operator_bool.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/boost/core/explicit_operator_bool.hpp b/include/boost/core/explicit_operator_bool.hpp index a8936e2..4660d6a 100644 --- a/include/boost/core/explicit_operator_bool.hpp +++ b/include/boost/core/explicit_operator_bool.hpp @@ -19,6 +19,7 @@ #define BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP #include +#include #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once @@ -121,12 +122,20 @@ namespace detail { return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\ } +#if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) + +#define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL() BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() + +#else + #define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\ BOOST_FORCEINLINE BOOST_CONSTEXPR operator boost::detail::unspecified_bool_type () const BOOST_NOEXCEPT\ {\ return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\ } +#endif + #else // !defined(BOOST_NO_UNSPECIFIED_BOOL) #define BOOST_EXPLICIT_OPERATOR_BOOL()\