Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2006-02-23 08:50:30


Joel de Guzman wrote:
> Tobias Schwinger wrote:
>>It's confix_p with VC7.1 -- that's why I cross post to spirit.devel.
>>If it's unfixable it would probably be a good idea to have a portability note in the docuementation.
>
> Yes we are aware of this problem. With VC7.1, I tend to avoid the
> confix stuff. The problem is somewhere in the complexity of the
> meta facilities of Spirit. Hopefully, this will go away with
> Spirit-2.
>

Maybe having an vague idea what causes the problem can help. Does anyone know more about it?

Here's my attempt of reconstructing another instance that occurs when

    int_p[& do_int]

is used in the wrong context (a case without confix stuff and hopefully less "meta depth").
 
    // define BOOM e [1;3] to make VC1 ICE

    #include <cstddef>
    #include <iostream>
    #include <boost/spirit/core.hpp>

    void do_int(int) { } // using a functor instead works

    template<std::size_t> struct take_size_t { typedef void type; };

    using namespace boost::spirit;

    #if ! defined BOOM
    template<typename T> struct wrap
    {
      // OK
      static const std::size_t value = sizeof(int_p[& do_int]);
      // wrapping the expression (see BOOM = { 2,3 }) also works

      typedef typename take_size_t<value>::type type;
    };
    #elif BOOM == 1
    template<typename T> struct wrap
    {
      // overloaded function: illegal sizeof operand
      // note: the function is *not* overloaded
      typedef take_size_t< sizeof( int_p[& do_int] ) >::type type;
    };
    #elif BOOM == 2
    template<typename U>
    U const & const_ref_bind(U const & u) { return u; }

    template<typename T> struct wrap
    {
      // ICE
      typedef take_size_t<
        sizeof(const_ref_bind(int_p[& do_int])) >::type
      type;
    };
    #else // BOOM == 3
    template<typename T, typename U>
    U const & depend_on_type(U const & u) { return u; }

    template<typename T> struct wrap
    {
      // ICE
      typedef typename take_size_t<
        sizeof(depend_on_type<T>(int_p[& do_int])) >::type
      type;
    };
    #endif

Thanks,

Tobias


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