[Boost-bugs] [Boost C++ Libraries] #10443: Compile errors with boost::fusion::invoke and boost::result_of using decltype

Subject: [Boost-bugs] [Boost C++ Libraries] #10443: Compile errors with boost::fusion::invoke and boost::result_of using decltype
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-02 14:18:57


#10443: Compile errors with boost::fusion::invoke and boost::result_of using
decltype
---------------------------------------------+---------------------
 Reporter: James Whitworth <fun4jimmy@…> | Owner: djowel
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: fusion
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: invoke result_of delctype c++11 |
---------------------------------------------+---------------------
 The following example fails to compile with c++11 compliant compilers.

 {{{#!c++
 #include <boost/bind.hpp>
 #include <boost/function.hpp>

 #include <boost/fusion/functional.hpp>

 void Function( int & output )
 {
   output = 12;
 }

 int main( int, char ** )
 {
   boost::fusion::vector1< int > parameters;
   boost::function< void( int & ) > function = &Function;

   boost::fusion::invoke( function, parameters );

   return 0;
 }
 }}}

 I think the problem is due to the implementation {{{boost::result}}} using
 decltype and {{{boost::fusion::invoke}}} expecting the old TR1 type
 behaviour. The example compiles fine when
 {{{BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK}}} is defined.

 Compiling the above with '''clang++ -std=c++11 main.cpp''' generates the
 following output:


 {{{
 In file included from main.cpp:4:
 In file included from /usr/local/include/boost/fusion/functional.hpp:13:
 In file included from
 /usr/local/include/boost/fusion/functional/invocation.hpp:13:
 In file included from
 /usr/local/include/boost/fusion/functional/invocation/invoke.hpp:96:
 In file included from
 /usr/local/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52:
 /usr/local/include/boost/fusion/functional/invocation/invoke.hpp:205:55:
 error: no type named 'type' in 'boost::result_of<boost::function<void (int
 &)> (const int &)>'
                     Function(BOOST_PP_ENUM(N,M,~)) >::type result_type;
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
 /usr/local/include/boost/fusion/functional/invocation/invoke.hpp:161:38:
 note: in instantiation of template class
 'boost::fusion::detail::invoke_impl<boost::function<void (int &)>, const
 boost::fusion::vector1<int>, 1, false, true>' requested here
             typedef typename detail::invoke_impl<
                                      ^
 /usr/local/include/boost/fusion/functional/invocation/invoke.hpp:179:32:
 note: in instantiation of template class
 'boost::fusion::result_of::invoke<boost::function<void (int &)>, const
 boost::fusion::vector1<int> >' requested here
     inline typename result_of::invoke<Function,Sequence const>::type
                                ^
 /usr/local/include/boost/fusion/functional/invocation/invoke.hpp:180:5:
 note: while substituting deduced template arguments into function template
 'invoke' [with Function = boost::function<void (int &)>, Sequence =
 boost::fusion::vector1<int>]
     invoke(Function f, Sequence const & s)
     ^
 1 error generated.
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10443>
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:16 UTC