[spirit] select_p problem

Hi All, boost::spirit::select_p parser can not be compiled with boost::spirit::rule as argument. The problem is that metafunction boost::spirit::impl::as_embedded_parser<ParserT> returns const reference to boost::spirit::rule, not boost::spirit::rule itself, when PaerserT = boost::spirit::rule. So trying to compile parser_result<as_embedded_parser<rule<> > > deep inside the select_p implementation generates error message that const rule<>& has no result_type. I suggest to change parser_result definition as following: template <typename ParserT, typename ScannerT> struct parser_result { typedef typename boost::remove_reference<ParserT>::type::template result<ScannerT>::type type; }; -- ______________________________ Vyacheslav E. Andrejev System Architect, Excelsior, LLC

Vyacheslav E. Andrejev wrote:
boost::spirit::select_p parser can not be compiled with boost::spirit::rule as argument.
The problem is that metafunction boost::spirit::impl::as_embedded_parser<ParserT> returns const reference to boost::spirit::rule, not boost::spirit::rule itself, when PaerserT = boost::spirit::rule. So trying to compile parser_result<as_embedded_parser<rule<> > > deep inside the select_p implementation generates error message that const rule<>& has no result_type.
I suggest to change parser_result definition as following:
template <typename ParserT, typename ScannerT> struct parser_result { typedef typename boost::remove_reference<ParserT>::type::template result<ScannerT>::type type; };
I'll change that. Could you provide a minimal example exposing this problem, I'd like to add this as a test case. Regards Hartmut
participants (2)
-
Hartmut Kaiser
-
Vyacheslav E. Andrejev