Subject: [Boost-bugs] [Boost C++ Libraries] #10676: [fusion] Compile errors with boost::fusion::fold due to boost::result_of picking wrong overload
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-10-19 17:47:18
#10676: [fusion] Compile errors with boost::fusion::fold due to boost::result_of
picking wrong overload
----------------------------------------+------------------------
Reporter: Jared Grubb <jaredgrubb@â¦> | Owner: djowel
Type: Bugs | Status: new
Milestone: To Be Determined | Component: fusion
Version: Boost 1.56.0 | Severity: Regression
Keywords: |
----------------------------------------+------------------------
I was updating from boost-1.51 to boost-1.56 and some of a parsing library
I have now fails to compile.
Notice how the errors occur in overloads requiring "const long&" but the
Visitor takes mutable values (long&). Somehow, it picks const and then
digs down.
I have two workarounds:
* use BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
* add an explicit instantiation of boost::fusion::result_of to disable
the selection that is causing the problem.
{{{
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/algorithm/iteration/fold.hpp>
#if WORKAROUND
struct Visitor;
namespace boost { namespace fusion { namespace result_of {
template<typename Seq>
struct fold<Seq const, int const, Visitor> {
/* Missing 'type' to disable this selection earlier */
};
} } }
#endif
struct Visitor
{
using result_type = int;
int operator()(int sum, long&)
{
return sum;
}
};
int main()
{
boost::fusion::vector<long> vec;
Visitor visitor{};
boost::fusion::fold(vec, 0, visitor);
}
}}}
Error:
{{{
$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
[ Using boost-1.51 ]
$ clang++ x.cpp --std=c++11 -DWORKAROUND
$ clang++ x.cpp --std=c++11
[ Using boost-1.56 ]
$ clang++ x.cpp --std=c++11 -DWORKAROUND
$ clang++ x.cpp --std=c++11
-DBOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
$ clang++ x.cpp --std=c++11
In file included from x.cpp:2:
In file included from
/Users/grubber/Downloads/boost_1_56_0/boost/fusion/algorithm/iteration/fold.hpp:33:
/Users/grubber/Downloads/boost_1_56_0/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp:265:24:
error: no type named 'type' in
'boost::result_of<Visitor (const int &, const long &)>'
>::type
~~~^~~~
/Users/grubber/Downloads/boost_1_56_0/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp:278:17:
note: in instantiation of template
class 'boost::fusion::detail::result_of_first_unrolledfold<const int
&, boost::fusion::vector_iterator<const boost::fusion::vector<long,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>,
0>, Visitor, 1>' requested here
result_of_first_unrolledfold<
^
/Users/grubber/Downloads/boost_1_56_0/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp:314:13:
note: in instantiation of template
class 'boost::fusion::detail::fold_impl<1, const int &, const
boost::fusion::vector<long, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_>, Visitor>' requested here
: fold_impl<
^
/Users/grubber/Downloads/boost_1_56_0/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp:328:13:
note: in instantiation of template
class 'boost::fusion::detail::result_of_fold<const
boost::fusion::vector<long, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_>, const int, Visitor, false>' requested here
: detail::result_of_fold<
^
/Users/grubber/Downloads/boost_1_56_0/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp:352:32:
note: in instantiation of template
class 'boost::fusion::result_of::fold<const
boost::fusion::vector<long, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>, const
int, Visitor>' requested here
inline typename result_of::fold<
^
x.cpp:29:5: note: while substituting deduced template arguments into
function template 'fold' [with Seq = boost::fusion::vector<long,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>,
State = int, F = Visitor]
boost::fusion::fold(vec, 0, visitor);
^
1 error generated.
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10676> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC