From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2005-05-17 07:41:37


 
David Abrahams wrote:

> > This I don't understand anymore. The code in question is:
> >
> > some_spirit_grammar g;
> > boost::spirit::pt_parse(it, end, g);
> >
> > the programm crashes inside pt_parse because of g == 0xcccccccc
> > (destroyed object), where pt_parse takes 'g' by const reference.
> > Initially 'g' was defined as a function local static
> instance, which
> > I've removed now because I had the suspicion CW8.x couldn't
> handle that correctly.
> >
> > Any clues?
> > Regards Hartmut
>
> Are you running into the CW 8.3 "CRTP bug" where casting to a
> derived class reference can induce a copy?

That's possible, since Spirit passes the parser<> base class around and
casts it to the correct derived class (type supplied through CRTP) when
needed. Is there a known workaround?

OTOH all the Spirit tests should fail if this assumption is correct.

Regards Hartmut