Re: [Boost-bugs] [Boost C++ Libraries] #9580: [spirit.lex] self("state") += calls a wrong operator +=

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9580: [spirit.lex] self("state") += calls a wrong operator +=
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-01-16 07:58:09


#9580: [spirit.lex] self("state") += calls a wrong operator +=
--------------------------------------+---------------------
  Reporter: Vyacheslav Andrejev | Owner: hkaiser
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: spirit
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
--------------------------------------+---------------------

Comment (by Vyacheslav Andrejev):

 An example that demonstrates the problem:
 {{{
 #!cpp
 #include <iostream>

 #include <boost/spirit/include/lex_lexertl.hpp>

 using namespace boost::spirit;

 template <typename Lexer>
 struct tokens : public lex::lexer<Lexer>
 {
   tokens()
   {
     someTokenDef = '"';

     auto expr = (this->self("SOME_STATE") += someTokenDef);
     std::cout << "Arity = " << expr.proto_arity_c << ", should be 0" <<
 std::endl;
     std::cout << "token_id_ = " << someTokenDef.id() << ", should be
 65536" << std::endl;
     std::cout << "unique_id_ = " << someTokenDef.unique_id() << ", should
 be 0" << std::endl;
     std::cout << "token_state_ = " << someTokenDef.state() << ", should be
 1" << std::endl;
   }

   lex::token_def<> someTokenDef;
 };

 int main(int argc, char* argv[]) {
   typedef std::string::iterator base_iterator_type;
   typedef lex::lexertl::token<
       base_iterator_type
     , boost::mpl::vector<>
> token_type;

   typedef lex::lexertl::lexer<token_type> lexer_type;
   typedef tokens<lexer_type> a_lexer;

   a_lexer lexer;

   return 0;
 }
 }}}

 The program above outputs:
 {{{
 Arity = 2, should be 0
 token_id_ = 0, should be 65536
 unique_id_ = 18446744073709551615, should be 0
 token_state_ = 18446744073709551615, should be 1
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9580#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC