aboutsummaryrefslogtreecommitdiff
path: root/ports/boost-variant/fix-regression-1.70.patch
blob: 79c0e2c23479a69f70990ca6ad508df6396abc0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
diff --git a/include/boost/variant/detail/apply_visitor_unary.hpp b/include/boost/variant/detail/apply_visitor_unary.hpp
index 71610cb..c3a741e 100644
--- a/include/boost/variant/detail/apply_visitor_unary.hpp
+++ b/include/boost/variant/detail/apply_visitor_unary.hpp
@@ -23,6 +23,7 @@
 #   include <boost/mpl/size.hpp>
 #   include <boost/utility/declval.hpp>
 #   include <boost/core/enable_if.hpp>
+#   include <boost/type_traits/copy_cv_ref.hpp>
 #   include <boost/type_traits/remove_reference.hpp>
 #   include <boost/variant/detail/has_result_type.hpp>
 #endif
@@ -85,7 +86,7 @@ namespace detail { namespace variant {
 // This class serves only metaprogramming purposes. none of its methods must be called at runtime!
 template <class Visitor, class Variant>
 struct result_multideduce1 {
-    typedef typename Variant::types                 types;
+    typedef typename remove_reference<Variant>::type::types types;
     typedef typename boost::mpl::begin<types>::type begin_it;
     typedef typename boost::mpl::advance<
         begin_it, boost::mpl::int_<boost::mpl::size<types>::type::value - 1>
@@ -95,14 +96,14 @@ struct result_multideduce1 {
     struct deduce_impl {
         typedef typename boost::mpl::next<It>::type next_t;
         typedef typename boost::mpl::deref<It>::type value_t;
-        typedef decltype(true ? boost::declval< Visitor& >()( boost::declval< value_t >() )
+        typedef decltype(true ? boost::declval< Visitor& >()( boost::declval< copy_cv_ref_t< value_t, Variant > >() )
                               : boost::declval< typename deduce_impl<next_t>::type >()) type;
     };
 
     template <class Dummy>
     struct deduce_impl<last_it, Dummy> {
         typedef typename boost::mpl::deref<last_it>::type value_t;
-        typedef decltype(boost::declval< Visitor& >()( boost::declval< value_t >() )) type;
+        typedef decltype(boost::declval< Visitor& >()( boost::declval< copy_cv_ref_t< value_t, Variant > >() )) type;
     };
 
     typedef typename deduce_impl<begin_it>::type type;
@@ -132,7 +133,7 @@ inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable,
         boost::detail::variant::has_result_type<Visitor>
     >::type* = 0)
 {
-    boost::detail::variant::result_wrapper1<Visitor, typename remove_reference<Visitable>::type> cpp14_vis(::boost::forward<Visitor>(visitor));
+    boost::detail::variant::result_wrapper1<Visitor, Visitable> cpp14_vis(::boost::forward<Visitor>(visitor));
     return ::boost::forward<Visitable>(visitable).apply_visitor(cpp14_vis);
 }