Boost C++ Libraries: Ticket #6343: Spirit::qi semantic action destroys attribute value https://svn.boost.org/trac10/ticket/6343 <p> Long story short. This code: </p> <pre class="wiki">#include &lt;boost/config/warning_disable.hpp&gt; #include &lt;boost/spirit/include/qi.hpp&gt; #include &lt;boost/foreach.hpp&gt; #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt; void f(){return;} int main() { namespace qi = boost::spirit::qi; namespace ns = boost::spirit::ascii; qi::rule&lt;std::string::iterator,std::vector&lt;int&gt;(),ns::space_type&gt; ex; ex = qi::int_[f] &gt;&gt; *ex; std::string str = "3 1 4 1 5 9"; std::vector&lt;int&gt; out; if(qi::phrase_parse(str.begin(),str.end(),ex,ns::space,out)) { std::cout &lt;&lt; "Result: "; BOOST_FOREACH(int d , out) std::cout &lt;&lt; d &lt;&lt; " , "; std::cout &lt;&lt; "\n"; } } </pre><p> Doesn't change the contents of the "std::vector&lt;int&gt; out". </p> <p> If I remove the semantic action: <code> ex = qi::int_ &gt;&gt; *ex; </code> </p> <p> Then everything goes as expected. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6343 Trac 1.4.3 Joel de Guzman Mon, 02 Jan 2012 00:15:27 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6343#comment:1 https://svn.boost.org/trac10/ticket/6343#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> When a semantic action is present anywhere in a rule, automatic attribute propagation is disabled. If you want to force attribute propagation, you can use the %= operator: </p> <blockquote> <p> ex %= qi::int_[f] &gt;&gt; *ex; </p> </blockquote> <p> BTW, the proper forum for support is the Spirit mailing lists: <a class="ext-link" href="http://boost-spirit.com/home/feedback-and-support/"><span class="icon">​</span>http://boost-spirit.com/home/feedback-and-support/</a>. Please ask the list first before flagging this as a bug here. </p> Ticket