id summary reporter owner description type status milestone component version severity resolution keywords cc 10676 [fusion] Compile errors with boost::fusion::fold due to boost::result_of picking wrong overload Jared Grubb Joel de Guzman "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 #include #if WORKAROUND struct Visitor; namespace boost { namespace fusion { namespace result_of { template struct fold { /* 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 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' >::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, 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, 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 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 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, State = int, F = Visitor] boost::fusion::fold(vec, 0, visitor); ^ 1 error generated. }}}" Bugs closed To Be Determined fusion Boost 1.56.0 Regression fixed