#1133 closed Bugs (wontfix)
compile error for parsing a string on vc2005
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | spirit |
Version: | Boost 1.34.1 | Severity: | Problem |
Keywords: | Cc: |
Description
#include <string> #include <boost/spirit/core.hpp> extern std::string s; extern boost::spirit::rule<> r; void compile_failed() { boost::spirit::parse(s.begin(), s.end(), r); } /**/
This is the error message the compiler reported:
1>parse.cpp 1>c:\documents and settings\yangbo\桌面\work\research\boost\boost\spirit\core\non_terminal\impl\rule.ipp(190) : error C2664: “boost::spirit::impl::abstract_parser<ScannerT,AttrT>::do_parse_virtual”: 不能将参数 1 从“const boost::spirit::scanner<IteratorT,PoliciesT>”转换为“const boost::spirit::scanner<> &” 1> with 1> [ 1> ScannerT=boost::spirit::scanner<>, 1> AttrT=boost::spirit::nil_t 1> ] 1> and 1> [ 1> IteratorT=std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>, 1> PoliciesT=boost::spirit::scanner_policies<> 1> ] 1> 原因如下: 无法从“const boost::spirit::scanner<IteratorT,PoliciesT>”转换为“const boost::spirit::scanner<>” 1> with 1> [ 1> IteratorT=std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>, 1> PoliciesT=boost::spirit::scanner_policies<> 1> ] 1> 没有可用于执行该转换的用户定义的转换运算符,或者无法调用该运算符 1> c:\documents and settings\yangbo\桌面\work\research\boost\boost\spirit\core\non_terminal\impl\rule.ipp(172): 参见对正在编译的函数 模板 实例化“boost::spirit::match<boost::spirit::nil_t> boost::spirit::impl::rule_base<DerivedT,EmbedT,T0,T1,T2>::parse_main<ScannerT>(const ScannerT &) const”的引用 1> with 1> [ 1> DerivedT=boost::spirit::rule<>, 1> EmbedT=const boost::spirit::rule<> &, 1> T0=boost::spirit::nil_t, 1> T1=boost::spirit::nil_t, 1> T2=boost::spirit::nil_t, 1> ScannerT=boost::spirit::scanner<std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>,boost::spirit::scanner_policies<>> 1> ] 1> c:\documents and settings\yangbo\桌面\work\research\boost\boost\spirit\core\impl\parser.ipp(28): 参见对正在编译的函数 模板 实例化“boost::spirit::match<boost::spirit::nil_t> boost::spirit::impl::rule_base<DerivedT,EmbedT,T0,T1,T2>::parse<boost::spirit::scanner<IteratorT,PoliciesT>>(const ScannerT &) const”的引用 1> with 1> [ 1> DerivedT=boost::spirit::rule<>, 1> EmbedT=const boost::spirit::rule<> &, 1> T0=boost::spirit::nil_t, 1> T1=boost::spirit::nil_t, 1> T2=boost::spirit::nil_t, 1> IteratorT=std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>, 1> PoliciesT=boost::spirit::scanner_policies<>, 1> ScannerT=boost::spirit::scanner<std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>,boost::spirit::scanner_policies<>> 1> ] 1> c:\documents and settings\yangbo\桌面\work\research\http_client\parse.cpp(6): 参见对正在编译的函数 模板 实例化“boost::spirit::parse_info<IteratorT> boost::spirit::parse<std::_String_iterator<_Elem,_Traits,_Alloc>,DerivedT>(const IteratorT &,const IteratorT &,const boost::spirit::parser<DerivedT> &)”的引用 1> with 1> [ 1> IteratorT=std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>, 1> _Elem=char, 1> _Traits=std::char_traits<char>, 1> _Alloc=std::allocator<char>, 1> DerivedT=boost::spirit::rule<> 1> ]
Change History (4)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
This is not a bug. See comment above.
comment:3 by , 15 years ago
OK, but why does rule need know the iterator type, why not specify the iterator type when parsing?
comment:4 by , 15 years ago
The proper forum to discuss these issues is the Spirit mailing list: https://lists.sourceforge.net/lists/listinfo/spirit-general
Anyway, this is also discussed in the docs. IIRC, the FAQ also mentions the reasons.
Note:
See TracTickets
for help on using tickets.
Scanner incompatibility. See "The Scanner and Parsing" section. Try:
extern boost::spirit::rule<boost::spirit::scanner<std::string::iterator> > r;