1 /*=============================================================================
2 Copyright (c) 2014 Eric Niebler
3 Copyright (c) 2014 Kohei Takahashi
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(FUSION_SUPPORT_CONFIG_01092014_1718)
9 #define FUSION_SUPPORT_CONFIG_01092014_1718
11 #include <boost/config.hpp>
12 #include <boost/detail/workaround.hpp>
15 #ifndef BOOST_FUSION_GPU_ENABLED
16 #define BOOST_FUSION_GPU_ENABLED BOOST_GPU_ENABLED
19 // Enclose with inline namespace because unqualified lookup of GCC < 4.5 is broken.
26 // template <typename T> void foo(T) { }
31 // // prog.cc: In function 'int main()':
32 // // prog.cc:2: error: 'struct detail::foo' is not a function,
33 // // prog.cc:6: error: conflict with 'template<class T> void foo(T)'
34 // // prog.cc:10: error: in call to 'foo'
36 namespace boost { namespace fusion { namespace detail
39 using namespace barrier;
41 #define BOOST_FUSION_BARRIER_BEGIN namespace barrier {
42 #define BOOST_FUSION_BARRIER_END }
45 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1900))
46 // All of rvalue-reference ready MSVC don't perform implicit conversion from
47 // fundamental type to rvalue-reference of another fundamental type [1].
49 // Following example doesn't compile
52 // long &&l = i; // sigh..., std::forward<long&&>(i) also fail.
54 // however, following one will work.
57 // long &&l = static_cast<long &&>(i);
59 // OK, now can we replace all usage of std::forward to static_cast? -- I say NO!
60 // All of rvalue-reference ready Clang doesn't compile above static_cast usage [2], sigh...
63 // 1. https://connect.microsoft.com/VisualStudio/feedback/details/1037806/implicit-conversion-doesnt-perform-for-fund
64 // 2. http://llvm.org/bugs/show_bug.cgi?id=19917
66 // Tentatively, we use static_cast to forward if run under MSVC.
67 # define BOOST_FUSION_FWD_ELEM(type, value) static_cast<type&&>(value)
69 # define BOOST_FUSION_FWD_ELEM(type, value) std::forward<type>(value)
73 // Workaround for LWG 2408: C++17 SFINAE-friendly std::iterator_traits.
74 // http://cplusplus.github.io/LWG/lwg-defects.html#2408
76 // - GCC 4.5 enables the feature under C++11.
77 // https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01105.html
79 // - MSVC 10.0 implements iterator intrinsics; MSVC 13.0 implements LWG2408.
80 #if (defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 40500) && \
81 defined(BOOST_LIBSTDCXX11)) || \
82 (defined(BOOST_MSVC) && (1600 <= BOOST_MSVC && BOOST_MSVC < 1900))
83 # define BOOST_FUSION_WORKAROUND_FOR_LWG_2408
87 struct iterator_traits;
92 // Workaround for older GCC that doesn't accept `this` in constexpr.
93 #if BOOST_WORKAROUND(BOOST_GCC, < 40700)
94 #define BOOST_FUSION_CONSTEXPR_THIS
96 #define BOOST_FUSION_CONSTEXPR_THIS BOOST_CONSTEXPR