[spirit][phoenix] Spirit v2 conflicts with Phoenix v3

Hi, Recently I tried to port my code to Boost.Spirit v2 and Boost.Phoenix v3. After including the following headers: #include <boost/phoenix/core.hpp> #include <boost/spirit/include/qi_core.hpp> I got the following error: In file included from ./boost/spirit/home/phoenix/core.hpp:13:0, from ./boost/spirit/include/phoenix_core.hpp:14, from ./boost/spirit/home/support/make_component.hpp:15, from ./boost/spirit/home/support/meta_compiler.hpp:20, from ./boost/spirit/home/qi/domain.hpp:15, from ./boost/spirit/home/qi/parser.hpp:15, from ./boost/spirit/include/qi_core.hpp:16, from libs/log/src/text_file_backend.cpp:51: ./boost/spirit/home/phoenix/core/actor.hpp:46:16: error: redefinition of ‘struct boost::phoenix::detail::error_expecting_arguments’ ./boost/phoenix/core/actor.hpp:41:16: error: previous definition of ‘struct boost::phoenix::detail::error_expecting_arguments’ ./boost/spirit/home/phoenix/core/actor.hpp:65:12: error: redefinition of ‘struct boost::phoenix::actor<Expr>’ ./boost/phoenix/core/actor.hpp:161:12: error: previous definition of ‘struct boost::phoenix::actor<Expr>’ I take it the problem is that Boost.Spirit always include Phoenix v2 which causes name clashes with v3. Is this a known problem? Shouldn't Boost.Spirit include Phoenix v3 headers instead? I can see v3 redirects includes to v2 if BOOST_PHOENIX_USE_V2_OVER_V3 macro is defined (BTW, there's an error in boost/phoenix/stl.hpp: BOOST_PHOENIX_USE_V2 macro is checked instead). This happens in the release branch.

On 07/19/2012 04:39 PM, Andrey Semashev wrote:
Hi,
Recently I tried to port my code to Boost.Spirit v2 and Boost.Phoenix v3. After including the following headers:
#include<boost/phoenix/core.hpp> #include<boost/spirit/include/qi_core.hpp>
I got the following error:
In file included from ./boost/spirit/home/phoenix/core.hpp:13:0, from ./boost/spirit/include/phoenix_core.hpp:14, from ./boost/spirit/home/support/make_component.hpp:15, from ./boost/spirit/home/support/meta_compiler.hpp:20, from ./boost/spirit/home/qi/domain.hpp:15, from ./boost/spirit/home/qi/parser.hpp:15, from ./boost/spirit/include/qi_core.hpp:16, from libs/log/src/text_file_backend.cpp:51: ./boost/spirit/home/phoenix/core/actor.hpp:46:16: error: redefinition of ‘struct boost::phoenix::detail::error_expecting_arguments’ ./boost/phoenix/core/actor.hpp:41:16: error: previous definition of ‘struct boost::phoenix::detail::error_expecting_arguments’ ./boost/spirit/home/phoenix/core/actor.hpp:65:12: error: redefinition of ‘struct boost::phoenix::actor<Expr>’ ./boost/phoenix/core/actor.hpp:161:12: error: previous definition of ‘struct boost::phoenix::actor<Expr>’
I take it the problem is that Boost.Spirit always include Phoenix v2 which causes name clashes with v3.
Is this a known problem? Shouldn't Boost.Spirit include Phoenix v3 headers instead? I can see v3 redirects includes to v2 if BOOST_PHOENIX_USE_V2_OVER_V3 macro is defined (BTW, there's an error in boost/phoenix/stl.hpp: BOOST_PHOENIX_USE_V2 macro is checked instead).
This happens in the release branch. You should define BOOST_SPIRIT_USE_PHOENIX_V3 instead, as documented here: http://www.boost.org/doc/libs/1_50_0/libs/spirit/doc/html/spirit/what_s_new/... This probably needs a bit more exposure, the macros defined in phoenix are a leftover from earlier days and should be ignored.
_______________________________________________ Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On Thursday 19 July 2012 16:49:03 Thomas Heller wrote:
On 07/19/2012 04:39 PM, Andrey Semashev wrote:
You should define BOOST_SPIRIT_USE_PHOENIX_V3 instead, as documented here: http://www.boost.org/doc/libs/1_50_0/libs/spirit/doc/html/spirit/what_s_new/ spirit_2_5.html This probably needs a bit more exposure, the macros defined in phoenix are a leftover from earlier days and should be ignored.
Thanks, that helped. The macro could use a better exposure, indeed.

On Thursday 19 July 2012 16:49:03 Thomas Heller wrote:
You should define BOOST_SPIRIT_USE_PHOENIX_V3 instead...
Sorry, I didn't go much further. Now it breaks in the following code: bool parse_counter_placeholder(path_string_type::const_iterator& it, path_string_type::const_iterator end, unsigned int& width) { return qi::parse ( it, end, ( qi::uint_[phoenix::ref(width) = qi::_1_type()] ) ); } The error is: In file included from ./boost/phoenix/core/actor.hpp:19:0, from ./boost/phoenix/core.hpp:15, from libs/log/src/text_file_backend.cpp:50: ./boost/phoenix/core/is_nullary.hpp: In instantiation of ‘boost::phoenix::result_of::is_nullary<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<unsigned int> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l>, void>’: ./boost/phoenix/core/detail/preprocessed/actor_result_of_10.hpp:38:13: instantiated from ‘boost::phoenix::result_of::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<unsigned int> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l>, void, void, void, void, void, void, void, void, void, void, void>’ ./boost/phoenix/core/actor.hpp:240:9: instantiated from ‘boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<unsigned int> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l> >’ libs/log/src/text_file_backend.cpp:335:67: instantiated from here ./boost/phoenix/core/is_nullary.hpp:115:16: error: base type ‘boost::phoenix::evaluator::impl<const boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<unsigned int> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l>&, boost::phoenix::vector2<mpl_::bool_<true>, boost::phoenix::is_nullary>, int>::result_type {aka const boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<unsigned int> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l>&}’ fails to be a struct or class type path_string_type is a flavour of std::basic_string. The code looks pretty much like what is in Boost.Spirit docs. Am I doing something wrong?

On Thursday, July 19, 2012 20:31:24 Andrey Semashev wrote:
On Thursday 19 July 2012 16:49:03 Thomas Heller wrote:
You should define BOOST_SPIRIT_USE_PHOENIX_V3 instead...
Sorry, I didn't go much further. Now it breaks in the following code:
bool parse_counter_placeholder(path_string_type::const_iterator& it, path_string_type::const_iterator end, unsigned int& width) { return qi::parse ( it, end, ( qi::uint_[phoenix::ref(width) = qi::_1_type()] ) ); }
A minimal, self contained testcase we can try would be most helpful!
The error is:
In file included from ./boost/phoenix/core/actor.hpp:19:0, from ./boost/phoenix/core.hpp:15, from libs/log/src/text_file_backend.cpp:50: ./boost/phoenix/core/is_nullary.hpp: In instantiation of ‘boost::phoenix::result_of::is_nullary<boost::proto::exprns_::basic_expr<boo st::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto ::tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<unsigned int> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l>, void>’: ./boost/phoenix/core/detail/preprocessed/actor_result_of_10.hpp:38:13: instantiated from ‘boost::phoenix::result_of::actor<boost::proto::exprns_::basic_expr<boost::p roto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto ::tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<unsigned int> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l>, void, void, void, void, void, void, void, void, void, void, void>’ ./boost/phoenix/core/actor.hpp:240:9: instantiated from ‘boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns _::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto ::tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<unsigned int> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l> >’ libs/log/src/text_file_backend.cpp:335:67: instantiated from here ./boost/phoenix/core/is_nullary.hpp:115:16: error: base type ‘boost::phoenix::evaluator::impl<const boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto: :tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<unsigned int> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l>&, boost::phoenix::vector2<mpl_::bool_<true>, boost::phoenix::is_nullary>, int>::result_type {aka const boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto: :tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<unsigned int> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l>&}’ fails to be a struct or class type
path_string_type is a flavour of std::basic_string. The code looks pretty much like what is in Boost.Spirit docs. Am I doing something wrong?
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On Friday 20 July 2012 06:57:34 Thomas Heller wrote:
On Thursday, July 19, 2012 20:31:24 Andrey Semashev wrote:
On Thursday 19 July 2012 16:49:03 Thomas Heller wrote:
You should define BOOST_SPIRIT_USE_PHOENIX_V3 instead...
Sorry, I didn't go much further. Now it breaks in the following code: bool parse_counter_placeholder(path_string_type::const_iterator& it,
path_string_type::const_iterator end, unsigned int& width)
{
return qi::parse (
it, end, (
qi::uint_[phoenix::ref(width) = qi::_1_type()]
)
);
}
A minimal, self contained testcase we can try would be most helpful!
Sure, there you go: http://pastebin.com/HD2Pnys6 I'm using gcc 4.6 with Boost release branch.

On 07/20/2012 10:33 AM, Andrey Semashev wrote:
On Friday 20 July 2012 06:57:34 Thomas Heller wrote:
On Thursday, July 19, 2012 20:31:24 Andrey Semashev wrote:
On Thursday 19 July 2012 16:49:03 Thomas Heller wrote:
You should define BOOST_SPIRIT_USE_PHOENIX_V3 instead... Sorry, I didn't go much further. Now it breaks in the following code: bool parse_counter_placeholder(path_string_type::const_iterator& it,
path_string_type::const_iterator end, unsigned int& width)
{
return qi::parse (
it, end, (
qi::uint_[phoenix::ref(width) = qi::_1_type()]
)
);
} A minimal, self contained testcase we can try would be most helpful! Sure, there you go:
I'm using gcc 4.6 with Boost release branch. You need to include boost/phoenix/operator.hpp in order to use the operators like operator=
_______________________________________________ Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Andrey Semashev
-
Thomas Heller