Boost logo

Boost :

Subject: Re: [boost] [result_of] now uses decltype on release branch
From: Michel Morin (mimomorin_at_[hidden])
Date: 2012-09-02 23:10:09


Joel de Guzman wrote:
>> I also hope that we won't have to ship a broken Phoenix in 1.52 -- that
>> the Phoenix maintainers will step up and fix it. Joel, Thomas?
>
>
> Sure, let's do it. Thomas?

Joel, Fusion's invoke test (libs/fusion/test/invoke.test) fails
with decltype-based result_of.

The reason of the test failure is that fusion::invoke tries to
instantiate boost::result_of with uncallable signatures.
(Just making boost::result_of SFINAE-able does not solve the problem.)

Here is a minimal test case:

    #include <boost/fusion/include/invoke.hpp>
    #include <boost/fusion/include/vector.hpp>

    struct F {
        typedef void result_type;
        void operator()(int&) const {}
    };

    int main (int argc, char* argv[])
    {
        boost::fusion::vector<int> v(1);
        // Error when decltype-based result_of is used;
        // trying to instantiate result_of<F(const int&)>
        boost::fusion::invoke(F(), v);

        return 0;
    }

But, to be more precise, the above problem also happens with
TR1-style result_of. For example, the following code fails
to compile even with TR1-style result_of.

    #include <boost/fusion/include/invoke.hpp>
    #include <boost/fusion/include/vector.hpp>

    struct F {
        template <typename Sig>
        struct result;
        template <typename This>
        struct result<This(int&)>
        {
            typedef void type;
        };
        void operator()(int&) const {}
    };

    int main (int argc, char* argv[])
    {
        boost::fusion::vector<int> v(1);

        // Error;
        // trying to instantiate result_of<F(const int&)>
        boost::fusion::invoke(F(), v);

        return 0;
    }

And here is a related ticket
    https://svn.boost.org/trac/boost/ticket/6915

Regards,
Michel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk