Chris@102
|
1 /*=============================================================================
|
Chris@102
|
2 Copyright (c) 2014 Eric Niebler
|
Chris@102
|
3 Copyright (c) 2014 Kohei Takahashi
|
Chris@102
|
4
|
Chris@102
|
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@102
|
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
7 ==============================================================================*/
|
Chris@102
|
8 #if !defined(FUSION_SUPPORT_CONFIG_01092014_1718)
|
Chris@102
|
9 #define FUSION_SUPPORT_CONFIG_01092014_1718
|
Chris@102
|
10
|
Chris@102
|
11 #include <boost/config.hpp>
|
Chris@102
|
12 #include <boost/detail/workaround.hpp>
|
Chris@102
|
13
|
Chris@102
|
14 #ifndef BOOST_FUSION_GPU_ENABLED
|
Chris@102
|
15 #define BOOST_FUSION_GPU_ENABLED BOOST_GPU_ENABLED
|
Chris@102
|
16 #endif
|
Chris@102
|
17
|
Chris@102
|
18 // Enclose with inline namespace because unqualified lookup of GCC < 4.5 is broken.
|
Chris@102
|
19 //
|
Chris@102
|
20 // namespace detail {
|
Chris@102
|
21 // struct foo;
|
Chris@102
|
22 // struct X { };
|
Chris@102
|
23 // }
|
Chris@102
|
24 //
|
Chris@102
|
25 // template <typename T> void foo(T) { }
|
Chris@102
|
26 //
|
Chris@102
|
27 // int main()
|
Chris@102
|
28 // {
|
Chris@102
|
29 // foo(detail::X());
|
Chris@102
|
30 // // prog.cc: In function 'int main()':
|
Chris@102
|
31 // // prog.cc:2: error: 'struct detail::foo' is not a function,
|
Chris@102
|
32 // // prog.cc:6: error: conflict with 'template<class T> void foo(T)'
|
Chris@102
|
33 // // prog.cc:10: error: in call to 'foo'
|
Chris@102
|
34 // }
|
Chris@102
|
35 namespace boost { namespace fusion { namespace detail
|
Chris@102
|
36 {
|
Chris@102
|
37 namespace barrier { }
|
Chris@102
|
38 using namespace barrier;
|
Chris@102
|
39 }}}
|
Chris@102
|
40 #define BOOST_FUSION_BARRIER_BEGIN namespace barrier {
|
Chris@102
|
41 #define BOOST_FUSION_BARRIER_END }
|
Chris@102
|
42
|
Chris@102
|
43
|
Chris@102
|
44 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1900))
|
Chris@102
|
45 // All of rvalue-reference ready MSVC don't perform implicit conversion from
|
Chris@102
|
46 // fundamental type to rvalue-reference of another fundamental type [1].
|
Chris@102
|
47 //
|
Chris@102
|
48 // Following example doesn't compile
|
Chris@102
|
49 //
|
Chris@102
|
50 // int i;
|
Chris@102
|
51 // long &&l = i; // sigh..., std::forward<long&&>(i) also fail.
|
Chris@102
|
52 //
|
Chris@102
|
53 // however, following one will work.
|
Chris@102
|
54 //
|
Chris@102
|
55 // int i;
|
Chris@102
|
56 // long &&l = static_cast<long &&>(i);
|
Chris@102
|
57 //
|
Chris@102
|
58 // OK, now can we replace all usage of std::forward to static_cast? -- I say NO!
|
Chris@102
|
59 // All of rvalue-reference ready Clang doesn't compile above static_cast usage [2], sigh...
|
Chris@102
|
60 //
|
Chris@102
|
61 // References:
|
Chris@102
|
62 // 1. https://connect.microsoft.com/VisualStudio/feedback/details/1037806/implicit-conversion-doesnt-perform-for-fund
|
Chris@102
|
63 // 2. http://llvm.org/bugs/show_bug.cgi?id=19917
|
Chris@102
|
64 //
|
Chris@102
|
65 // Tentatively, we use static_cast to forward if run under MSVC.
|
Chris@102
|
66 # define BOOST_FUSION_FWD_ELEM(type, value) static_cast<type&&>(value)
|
Chris@102
|
67 #else
|
Chris@102
|
68 # define BOOST_FUSION_FWD_ELEM(type, value) std::forward<type>(value)
|
Chris@102
|
69 #endif
|
Chris@102
|
70
|
Chris@102
|
71
|
Chris@102
|
72 // Workaround for LWG 2408: C++17 SFINAE-friendly std::iterator_traits.
|
Chris@102
|
73 // http://cplusplus.github.io/LWG/lwg-defects.html#2408
|
Chris@102
|
74 //
|
Chris@102
|
75 // - GCC 4.5 enables the feature under C++11.
|
Chris@102
|
76 // https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01105.html
|
Chris@102
|
77 //
|
Chris@102
|
78 // - MSVC 10.0 implements iterator intrinsics; MSVC 13.0 implements LWG2408.
|
Chris@102
|
79 #if (defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 40500) && \
|
Chris@102
|
80 defined(BOOST_LIBSTDCXX11)) || \
|
Chris@102
|
81 (defined(BOOST_MSVC) && (1600 <= BOOST_MSVC || BOOST_MSVC < 1900))
|
Chris@102
|
82 # define BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
Chris@102
|
83 namespace std
|
Chris@102
|
84 {
|
Chris@102
|
85 template <typename>
|
Chris@102
|
86 struct iterator_traits;
|
Chris@102
|
87 }
|
Chris@102
|
88 #endif
|
Chris@102
|
89
|
Chris@102
|
90 #endif
|