Opened 12 years ago
Closed 9 years ago
#4684 closed Bugs (fixed)
[spirit] bad template error when complementing a rule
Reported by: | Eric Niebler | Owned by: | Joel de Guzman |
---|---|---|---|
Milestone: | Boost 1.45.0 | Component: | spirit |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
The following code results in a terrible compiler error. The grammar for Spirit should not allow ~
to apply to a rule
object.
#include <boost/spirit/home/qi.hpp> int main() { using namespace boost::spirit::qi; rule<char const *> expression, term, factor; expression = term >> *( ( '+' >> term ) | ( '-' >> term ) ) ; term = factor >> *( ( '*' >> ~factor ) | ( '/' >> factor ) ) ; factor = uint_ | '(' >> expression >> ')' | '-' >> factor ; }
Change History (4)
comment:1 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 12 years ago
If the grammar disallowed it, the error message would have been short and meaningful, caught in rule::operator=
. Instead, the error happens deep in Spirit's meta-guts. At least it did the last time I checked.
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.
comment:3 by , 12 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Eric has a valid point. I'll reopen this ticket and try to fix this.
comment:4 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This has long since been fixed. Now we get "Static_assert failed "subject_is_not_negatable".
Well, the error you're seeing is exactly caused by the ~, so in a sense the grammar doesn't allow using it, no?