Boost logo

Boost :

Subject: Re: [boost] [proto][1.43] Problem with proto::matches
From: Eric Niebler (eric_at_[hidden])
Date: 2010-08-07 10:47:12


On 8/7/2010 9:52 AM, Antoine de Maricourt wrote:
> Le 07/08/2010 00:00, Eric Niebler a écrit :
>> Can you please send a program I can use to reproduce the error?
>
> The most simple form I came to is below:
>
> #include <boost/proto/proto.hpp>
>
> namespace bp = boost::proto;
>
> template <typename A> struct B
> : bp::terminal<A>::type { };
>
> int main()
> {
> BOOST_MPL_ASSERT((
> bp::matches< bp::terminal< B<int[2]> >::type, bp::terminal< B<bp::_>
> > > ));
> }

First, let me say that what you're doing here is a little unusual.
You're creating a proto terminal that contains ... a proto terminal.
Which is fine; a proto terminal is an object like any other and can be
put inside another proto terminal, but you should know that Proto will
treat anything inside a proto terminal a just a blob; it will not try to
do any further matching or introspection on it.

That said, this code should work. I've simplified a bit:

    #include <boost/proto/proto.hpp>
    namespace bp = boost::proto;

    template<typename A>
    struct B
    {};

    int main()
    {
        BOOST_MPL_ASSERT((
            bp::matches<
                bp::terminal< B<int[2]> >::type
              , bp::terminal< B<bp::_> >
>
        ));
    }

B doesn't inherit from proto::terminal anymore; the problem is the same.
It's as you described and your patch is correct. Thanks.

I just committed a fix to trunk. It won't be in the upcoming 1.44, but
it'll be in 1.45.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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