Boost logo

Boost Users :

Subject: [Boost-users] [spirit-qi] [attr] Invalid static_cast error
From: º¬Â¶Ôº¬Â¶Ô (yaoyuan1216_at_[hidden])
Date: 2017-03-03 08:40:31


Hi,
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 list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net