Opened 11 years ago
Last modified 11 years ago
#6444 reopened Bugs
qi::lit(<char>) parses into a '\0' in 1.47 and 1.48
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | spirit |
Version: | Boost 1.48.0 | Severity: | Regression |
Keywords: | Cc: |
Description
In 1.46.0, qi::lit(<char>) would end up in the result. This changed in 1.47.0 such that they were not parsed into the result (qi::char_ is to be used instead). However, NUL characters now show up in the resulting token. Example code and output attached.
Synopsis:
Parser: +(qi::alnum | qi::lit('-'))
Input: "a-b-c"
1.46.0: "a-b-c"
1.47.0: "a\000b\000c"
1.48.0: "a\000b\000c"
The '\000' characters can be seen in gdb; std::ostream just shows "abc" instead.
Attachments (2)
Change History (5)
by , 11 years ago
comment:1 by , 11 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Use char_ instead (as you hinted):
tok %=
+( qi::alnum
| qi::char_('-') | qi::char_('_') );
lit has an "unused" attribute ( http://tinyurl.com/6lu2stx ) while char gives you the character type of the enclosing character encoding namespace (e.g. ascii, unicode, etc.). The way "unused" attribute is synthesized is undefined.
The behavior you see is an upshot of the optimizations and refinement we did for 1.47 and higher. As such, for alternatives, we only synthesize the advertized attribute in cases like this where the client passed in a non-variant (std::string).
comment:2 by , 11 years ago
Right. That's fine. The bug is that an "unused" attribute should not insert NUL characters in the resulting match.
comment:3 by , 11 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Fair enough. Let's open this for discussion then. There might be a "fix", but I'd like to discuss this in the Spirit mailing list. I'll re-open this ticket. Could you please post a message to the list here: http://boost-spirit.com/home/feedback-and-support/
Thanks!
Small example code