
Joel de Guzman wrote:
Andrey Semashev wrote:
The docs say that the grammar should pass a reference to the starting rule to the base class constructor (qi::grammar specialization). But at this point the rule's constructor has not yet been called. What's more, the base class calls a method on the passed reference.
Where did you get that info? The base class does not call a method on the passed reference. That is not correct. It only does so at parse time and at that time, everything has already been constructed.
Hmm... I may be misinterpreting what I see at boost/spirit/home/qi/nonterminal/grammar.hpp:54, in the release branch: grammar( start_type const& start , std::string const& name_ = "unnamed-grammar") => : proto::extends<terminal, base_type>(terminal::make(start.alias())) , name_(name_) {} Here "start" is a reference to a not yet constructed object.