Subject: [Boost-bugs] [Boost C++ Libraries] #6343: Spirit::qi semantic action destroys attribute value
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-01-01 22:55:50
#6343: Spirit::qi semantic action destroys attribute value
---------------------------------+------------------------------------------
Reporter: kkanishev@⦠| Owner: djowel
Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
Version: Boost 1.48.0 | Severity: Problem
Keywords: |
---------------------------------+------------------------------------------
Long story short. This code:
{{{
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/foreach.hpp>
#include <iostream>
#include <string>
#include <vector>
void f(){return;}
int main()
{
namespace qi = boost::spirit::qi;
namespace ns = boost::spirit::ascii;
qi::rule<std::string::iterator,std::vector<int>(),ns::space_type>
ex;
ex = qi::int_[f] >> *ex;
std::string str = "3 1 4 1 5 9";
std::vector<int> out;
if(qi::phrase_parse(str.begin(),str.end(),ex,ns::space,out))
{
std::cout << "Result: ";
BOOST_FOREACH(int d , out) std::cout << d << " , ";
std::cout << "\n";
}
}
}}}
Doesn't change the contents of the "std::vector<int> out".
If I remove the semantic action:
{{{ ex = qi::int_ >> *ex; }}}
Then everything goes as expected.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6343> 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:08 UTC