Opened 9 years ago
Closed 5 years ago
#8556 closed Bugs (fixed)
Cannot combine synthesized attributes with semantic actions in some cases
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | spirit |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: |
Description
The use of "%=" in rule definitions appears intended to permit simultaneous use of semantic actions and synthesized attributes. However, in some cases I find I can choose only one. In particular a rule of this form:
rule<Iterator, std::vector<std::string>()> r; r = qi::string >> qi::string >> qi::string;
successfully synthesizes its attribute, while the same rule defined this way:
r = (qi::string >> qi::string >> qi::string)[SA]
successfully compiles and runs its semantic action. However, combining them fails:
r %= (qi::string >> qi::string >> qi::string)[SA]
produces a compile error. Test case attached.
Attachments (1)
Change History (3)
by , 9 years ago
Attachment: | actiontest.cpp added |
---|
comment:1 by , 5 years ago
You should use #define BOOST_SPIRIT_ACTIONS_ALLOW_ATTR_COMPAT
if you want your code to compile.
The behavior you encountered is preserved to maintain the backward compatibility. http://boost.2283326.n4.nabble.com/fusion-vector2-std-pair-compatibility-td3529649i20.html
There are also other ways to solve your problem https://stackoverflow.com/questions/40723341/using-semantic-action-together-with-attribute-propagation-in-spirit
comment:2 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
standalone test case