Boost C++ Libraries: Ticket #2234: Spirit2/Phoenix compilation error (front on iterator_range) https://svn.boost.org/trac10/ticket/2234 <p> The following source: </p> <pre class="wiki">#include &lt;boost/spirit/include/qi.hpp&gt; using namespace ::boost::spirit; using namespace ::boost::spirit::qi; using namespace ::boost::spirit::arg_names; #include &lt;boost/spirit/include/phoenix_stl.hpp&gt; using namespace ::boost::phoenix; int main() { rule&lt; const wchar_t* &gt; r; r = raw[ wchar ][ front(_1) ]; return 0; } </pre><p> worked several months ago (before Spirit2 was brought in Boost svn), but no longer compiles with current svn-trunk, gcc gives the following error: </p> <pre class="wiki">.../boost/spirit/home/phoenix/stl/container/detail/container.hpp:42: error: no type named ‘const_reference’ in ‘const class boost::iterator_range&lt;const wchar_t*&gt;’ </pre><p> <br /> </p> <p> It seems due to <a class="changeset" href="https://svn.boost.org/trac10/changeset/44555" title="disallow mutability of attribute in actions">r44555</a> which made attributes const in actions, as <code>boost::iterator_range</code> does not contain a <code>const_reference</code> typedef. </p> <p> Note that replacing <code>front</code> with <code>*begin</code> works around the problem, since <code>boost::iterator_range</code> does contain a <code>const_iterator</code> typedef. </p> <p> <br /> </p> <p> I don't know enough about <code>iterator_range</code> and Phoenix type deduction to know in which one this should be fixed... please tell me if I should submit a feature request ticket to add a <code>const_reference</code> typedef to <code>iterator_range</code>. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2234 Trac 1.4.3 Joel de Guzman Wed, 20 Aug 2008 13:43:12 GMT <link>https://svn.boost.org/trac10/ticket/2234#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2234#comment:1</guid> <description> <p> Re: </p> <blockquote class="citation"> <blockquote> <p> I don't know enough about <code>iterator_range</code> and Phoenix type deduction to know in which one this should be fixed... please tell me if I should submit a feature request ticket to add a <code>const_reference</code> typedef to <code>iterator_range</code>. </p> </blockquote> </blockquote> <p> Perhaps it's a good idea to minimize the problem to something that calls <code>iterator_range</code> directly and ask the author (Thorsten Ottosen &amp; Pavol Droba) about it on the devel list. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sun, 29 Nov 2009 21:23:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2234#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2234#comment:2</guid> <description> <p> I think this has been fixed somewhere. The following compiles: </p> <pre class="wiki">#include &lt;boost/spirit/include/qi.hpp&gt; #include &lt;boost/spirit/include/qi_char_.hpp&gt; using namespace ::boost::spirit; using namespace ::boost::spirit::qi; #include &lt;boost/spirit/include/phoenix_stl.hpp&gt; using namespace ::boost::phoenix; int main() { rule&lt; const wchar_t* &gt; r; r = raw[ char_ ][ front(_1) ]; return 0; } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Fri, 04 Dec 2009 06:10:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2234#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2234#comment:3</guid> <description> <p> I can confirm that the code in the second comment compiles [ Mac OS X 10.6.2 / gcc 4.2.1/ boost trunk ], but the original poster's code does not. </p> <pre class="wiki">junk.cpp:4: error: ‘arg_names’ is not a namespace-name junk.cpp:4: error: expected namespace-name before ‘;’ token junk.cpp: In function ‘int main()’: junk.cpp:12: error: ‘wchar’ was not declared in this scope </pre> </description> <category>Ticket</category> </item> <item> <author>François Barel <frabar666@…></author> <pubDate>Fri, 04 Dec 2009 09:53:50 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/2234#comment:4 https://svn.boost.org/trac10/ticket/2234#comment:4 <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">fixed</span> </li> </ul> <p> The original code was for Spirit 2.0. As reported by commenter <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2" title="#2: Bugs: list::size should be const (closed: fixed)">#2</a>, it now works on trunk (<a class="changeset" href="https://svn.boost.org/trac10/changeset/58133" title="enhance split_unix() to allow unix style splitting of command line string">r58133</a>). </p> <p> The issue must have been solved when Spirit 2.1 was merged. </p> Ticket