[phoenix][spirit] catch_all issues in V3
Hello,
The following code doesn't compile (MSVC10, Boost 1.55). If I modify
"catch_all" line like this:
query = id[phx::try_[qi::_val = phx::bind(&string2test,
qi::_1)].catch_all [ qi::_pass = false ], qi::_val = qi::_val ];
...it compiles, but doesn't seem to invoke the semantic action in runtime.
It there a workaround that would both compile and work?
Thanks!
#define BOOST_SPIRIT_USE_PHOENIX_V3
#include <string>
#include
Igor R. wrote
Hello,
The following code doesn't compile (MSVC10, Boost 1.55). If I modify "catch_all" line like this: query = id[phx::try_[qi::_val = phx::bind(&string2test, qi::_1)].catch_all [ qi::_pass = false ], qi::_val = qi::_val ]; ...it compiles, but doesn't seem to invoke the semantic action in runtime. It there a workaround that would both compile and work?
Thanks!
In order to use Boost.Phoenix's comma operator you need to include "boost/spirit/include/phoenix_statement.hpp" (or maybe "boost/phoenix/statement/sequence.hpp"). If you don't the default comma operator is used and it ignores the first argument. -- View this message in context: http://boost.2283326.n4.nabble.com/phoenix-spirit-catch-all-issues-in-V3-tp4... Sent from the Boost - Users mailing list archive at Nabble.com.
In order to use Boost.Phoenix's comma operator you need to include "boost/spirit/include/phoenix_statement.hpp" (or maybe "boost/phoenix/statement/sequence.hpp").
That's the problem, I included "phoenix_statement.hpp", but it turned out the comma was not there, and the code just silently failed. Anyway, including phoenix.hpp always does the job :)
If I modify "catch_all" line like this: query = id[phx::try_[qi::_val = phx::bind(&string2test, qi::_1)].catch_all [ qi::_pass = false ], qi::_val = qi::_val ]; ...it compiles, but doesn't seem to invoke the semantic action in runtime.
Solved. It turns out that I failed to include the header where the relevant comma operator is defined.
participants (2)
-
Igor R
-
llonesmiz