Re: [Boost-bugs] [Boost C++ Libraries] #6915: boost::fusion::result_of::invoke compilation errors

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6915: boost::fusion::result_of::invoke compilation errors
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-04 15:04:17


#6915: boost::fusion::result_of::invoke compilation errors
--------------------------------+-------------------------------------------
  Reporter: ulidtko@… | Owner: djowel
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: fusion
   Version: Boost 1.49.0 | Severity: Problem
Resolution: fixed | Keywords:
--------------------------------+-------------------------------------------
Changes (by djowel):

  * status: new => closed
  * resolution: => fixed

Comment:

 I fixed this in trunk. The first test:

   try_invoke<F, boost::fusion::vector<float>> (0);

 now compiles just fine. The second test however is (IMO) erroneous:

   try_invoke<F, boost::fusion::vector<junk>> (0);

 This cannot select the fallback overload because

   typename boost::fusion::result_of::invoke<F, Sequence>::type

 will be erroneous and will not trigger SFINAE. The code attached is
 equivalent to this:

     #include <boost/utility/result_of.hpp>
     #include <iostream>

     int foo(int);
     struct junk {};

     template <typename F, typename Arg>
     typename boost::result_of<F(Arg)>::type
     call(int)
     {
         return F(Arg());
     }

     template <typename F, typename Arg>
     void call(long)
     {
         // fallback
         std::cout << "fallback" << std::endl;
     }

     int main()
     {
         call<int(*)(int), junk>(123);
     }

 which will give you an error. Notice though that if I replace:

   typename boost::result_of<F(Arg)>::type

 with

   decltype(F(Arg()))

 then it works. So the question now falls into the hands of the
 Boost::result_of maintainers. If you think this should work, then,
 go add a ticket to boost::result_of.

 I'm closing this one.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6915#comment:3>
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:10 UTC