Boost C++ Libraries: Ticket #4684: [spirit] bad template error when complementing a rule https://svn.boost.org/trac10/ticket/4684 <p> The following code results in a terrible compiler error. The grammar for Spirit should not allow <code>~</code> to apply to a <code>rule</code> object. </p> <pre class="wiki">#include &lt;boost/spirit/home/qi.hpp&gt; int main() { using namespace boost::spirit::qi; rule&lt;char const *&gt; expression, term, factor; expression = term &gt;&gt; *( ( '+' &gt;&gt; term ) | ( '-' &gt;&gt; term ) ) ; term = factor &gt;&gt; *( ( '*' &gt;&gt; ~factor ) | ( '/' &gt;&gt; factor ) ) ; factor = uint_ | '(' &gt;&gt; expression &gt;&gt; ')' | '-' &gt;&gt; factor ; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4684 Trac 1.4.3 Hartmut Kaiser Sat, 16 Apr 2011 18:55:10 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4684#comment:1 https://svn.boost.org/trac10/ticket/4684#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">fixed</span> </li> </ul> <p> Well, the error you're seeing is exactly caused by the ~, so in a sense the grammar doesn't allow using it, no? </p> Ticket Eric Niebler Mon, 18 Apr 2011 15:04:21 GMT <link>https://svn.boost.org/trac10/ticket/4684#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4684#comment:2</guid> <description> <p> If the grammar disallowed it, the error message would have been short and meaningful, caught in <code>rule::operator=</code>. Instead, the error happens deep in Spirit's meta-guts. At least it did the last time I checked. </p> <p> If the error doesn't bother you, or if it's too much trouble to improve it, or if it would too severely affect compile times, then yes, close this bug. But don't close it because you think the grammar correctly handles this case. I don't think it does. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Tue, 19 Apr 2011 00:05:27 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/4684#comment:3 https://svn.boost.org/trac10/ticket/4684#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Eric has a valid point. I'll reopen this ticket and try to fix this. </p> Ticket Joel de Guzman Wed, 09 Apr 2014 02:16:34 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4684#comment:4 https://svn.boost.org/trac10/ticket/4684#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> This has long since been fixed. Now we get "Static_assert failed "subject_is_not_negatable". </p> Ticket