problem with _val in rule?
Jonathan Biggar <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <CAA=GnWin3547ve7672YqrNK-eLJQsuRC2-HJHx2n_NBBrKCkrw@mail.gmail.com> |
The code attached works with spirit 2.5.4 included with boost 1.65.1 , but fails if I remove the comment from "//[_val = _1]. Why does the semantic action fail to compile? Errors attached from gcc 5.4.0, code compiled with -std=c++11. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Spirit-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spirit-general
test.cpp
(text/x-c++src, 1.2 KB)
#define BOOST_RESULT_OF_USE_TR1
#define BOOST_SPIRIT_USE_PHOENIX_V3
#define BOOST_SPIRIT_QI_DEBUG
#include <iostream>
#include <string>
#include "boost/spirit/include/qi.hpp"
#include "boost/spirit/include/qi_int.hpp"
#include "boost/spirit/home/qi/nonterminal/simple_trace.hpp"
#include "boost/spirit/include/support_attributes.hpp"
#include "boost/spirit/include/phoenix_core.hpp"
#include "boost/spirit/home/qi/detail/assign_to.hpp"
#include "boost/wave/token_ids.hpp"
namespace qi = boost::spirit::qi;
template <typename Iterator>
struct TestGrammar : qi::grammar<Iterator, int()>
{
typedef qi::rule<Iterator, int()> IntRule;
IntRule r_start;
TestGrammar() : TestGrammar::base_type(r_start, "TestGrammar") {
using qi::omit;
using qi::int_;
using qi::_val;
using qi::_1;
using qi::_2;
using qi::skip;
r_start =
int_[_val = _1]
;
BOOST_SPIRIT_DEBUG_NODE(r_start);
}
};
int main(int, char **)
{
typedef std::string::iterator Iterator;
TestGrammar<Iterator> grammar;
std::string input1("1");
int p;
Iterator start = input1.begin();
Iterator finish = input1.end();
if (qi::parse(start, finish, grammar, p))
std::cout << "success! p = " << p << std::endl;
}
build.out
(application/octet-stream, 5.1 KB) - not displayed