[spirit-qi] [attr] Invalid static_cast error

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[spirit-qi] [attr] Invalid static_cast error

Boost - Users mailing list
I try to generate a string using qi::attr, and the following is the code.

#include <boost/spirit/include/qi.hpp>
namespace qi = boost::spirit::qi;
int main(){
  // ok
  qi::rule<char const *, std::string()> world = qi::attr("world");
  qi::rule<char const *, std::string()> rule = qi::eps > world;
  // error: invalid static_cast from type 'const char [6]' to type 'char'
  // qi::rule<char const *, std::string()> rule = qi::eps > qi::attr("world");

Do I miss something or it is a bug? How can I fix it without using extra rules or semantic actions.

Platform: win7 64bit
Compiler: gcc 4.9.1
Boost 1.63

Since I typed on my phone, forgive me if there are errors.

Best regards,
Yuan Yao
Boost-users mailing list
[hidden email]