Re: Ambiguous call to overloaded function
Michael Powell <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <CAMEoF_EFWiYFpFAw9QhYLfiCcoF_w8q7Ga+9vzD9NBDzf=Pu1g@mail.gmail.com> |
I'm not positive, this may be a similar situation as with: http://boost.2283326.n4.nabble.com/Spirit-X3-employee-cpp-compile-error-td4687704.html Related to VS2015 Update 3 support. With solutions that seem to revolve around necessity of BOOST_SPIRIT_DEFINE (?). Can someone clarify? Thank you. Cheers, Michael Powell On Fri, Nov 24, 2017 at 12:40 PM, Michael Powell <[email protected]> wrote: > Hello, > > I am trying to stand some unit tests up around my X3 rules, but > getting errors doing so: > > template<class Rule> > void VerifyRule(const std::string& s, Rule& r, bool expected_match) { > > using namespace boost::spirit::x3; > > auto first_ = s.begin(); > auto last_ = s.end(); > > >>> REQUIRE(phrase_parse(first_, last_, r, space) == expected_match); <<< > REQUIRE(first_ == last_); > } > > // ... > >>>> REQUIRE_NOTHROW(VerifyRule("12345", Port, true)); <<< > > // ... > > #include <boost/spirit/home/x3.hpp> > > namespace Kmsg { > > namespace IPv4 { > > using namespace boost::spirit; > using namespace boost::spirit::x3; > > x3::rule<class Port, std::uint16_t> const Port = "Port"; > > auto const Port_def = digit > | (char_('1', '9') >> digit[repeat(1, 3)]) > | (char_('1', '5') >> digit[repeat(4)]) > | (char_('6') >> char_('0', '4') >> digit[repeat(3)]) > | ("65" >> char_('0', '4') >> digit[repeat(2)]) > | ("655" >> char_('0', '2') >> digit) > | ("6553" >> char_('0', '5')) > ; > > BOOST_SPIRIT_DEFINE(Port); > } > } > > And which errors are: > > 2>------ Build started: Project: Rfc3986_Uri_RegexSyntaxVerification, > Configuration: Debug x64 ------ > 2> Rfc3986_Uri_BoostSpiritParsing.cpp > 2>/path/to/boost-1.65.1\boost/spirit/home/x3/nonterminal/rule.hpp(113): > error C2668: 'Kmsg::IPv4::parse_rule': ambiguous call to overloaded > function > 2> G:\Source\Kingdom > Software\Kingdom.Messaging\Working\src\transports/boost/spirit/ipv4/port.hpp(25): > note: could be 'bool > Kmsg::IPv4::parse_rule<Iterator,Context,Attribute_>(const > boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false>,Iterator > &,const Iterator &,const Context &,Attribute &)' [found using > argument-dependent lookup] > 2> with > 2> [ > 2> > Iterator=std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>, > 2> > Context=boost::spirit::x3::context<boost::spirit::x3::skipper_tag,const > boost::spirit::x3::standard::space_type,boost::spirit::x3::unused_type>, > 2> Attribute_=const boost::spirit::x3::unused_type, > 2> Attribute=const boost::spirit::x3::unused_type > 2> ] > 2> /path/to/boost-1.65.1\boost/spirit/home/x3/nonterminal/rule.hpp(27): > note: or 'boost::spirit::x3::detail::default_parse_rule_result > boost::spirit::x3::parse_rule<Kmsg::IPv4::Port,uint16_t,Iterator,Context,Attribute_>(boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false>,Iterator > &,const Iterator &,const Context &,ActualAttribute &)' > 2> with > 2> [ > 2> > Iterator=std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>, > 2> > Context=boost::spirit::x3::context<boost::spirit::x3::skipper_tag,const > boost::spirit::x3::standard::space_type,boost::spirit::x3::unused_type>, > 2> Attribute_=const boost::spirit::x3::unused_type, > 2> ActualAttribute=const boost::spirit::x3::unused_type > 2> ] > 2> /path/to/boost-1.65.1\boost/spirit/home/x3/nonterminal/rule.hpp(113): > note: while trying to match the argument list '(const > boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false>, > std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>, > const std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>, > const boost::spirit::x3::context<boost::spirit::x3::skipper_tag,const > Derived,boost::spirit::x3::unused_type>, const > boost::spirit::x3::unused_type)' > 2> with > 2> [ > 2> Derived=boost::spirit::x3::standard::space_type > 2> ] > 2> /path/to/boost-1.65.1\boost/spirit/home/x3/core/parse.hpp(117): > note: see reference to function template instantiation 'bool > boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false>::parse<Iterator,boost::spirit::x3::context<boost::spirit::x3::skipper_tag,const > Derived,boost::spirit::x3::unused_type>,Attribute>(Iterator &,const > Iterator &,const Context &,boost::spirit::x3::unused_type,Attribute_ > &) const' being compiled > 2> with > 2> [ > 2> > Iterator=std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>, > 2> Derived=boost::spirit::x3::standard::space_type, > 2> Attribute=const boost::spirit::x3::unused_type, > 2> > Context=boost::spirit::x3::context<boost::spirit::x3::skipper_tag,const > boost::spirit::x3::standard::space_type,boost::spirit::x3::unused_type>, > 2> Attribute_=const boost::spirit::x3::unused_type > 2> ] > 2> /path/to/boost-1.65.1\boost/spirit/home/x3/core/parse.hpp(117): > note: see reference to function template instantiation 'bool > boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false>::parse<Iterator,boost::spirit::x3::context<boost::spirit::x3::skipper_tag,const > Derived,boost::spirit::x3::unused_type>,Attribute>(Iterator &,const > Iterator &,const Context &,boost::spirit::x3::unused_type,Attribute_ > &) const' being compiled > 2> with > 2> [ > 2> > Iterator=std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>, > 2> Derived=boost::spirit::x3::standard::space_type, > 2> Attribute=const boost::spirit::x3::unused_type, > 2> > Context=boost::spirit::x3::context<boost::spirit::x3::skipper_tag,const > boost::spirit::x3::standard::space_type,boost::spirit::x3::unused_type>, > 2> Attribute_=const boost::spirit::x3::unused_type > 2> ] > 2> /path/to/boost-1.65.1\boost/spirit/home/x3/core/parse.hpp(162): > note: see reference to function template instantiation 'bool > boost::spirit::x3::phrase_parse_main<Iterator,Parser,Skipper,const > boost::spirit::x3::unused_type>(Iterator &,Iterator,const Parser > &,const Skipper &,Attribute &,boost::spirit::x3::skip_flag)' being > compiled > 2> with > 2> [ > 2> > Iterator=std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>, > 2> Parser=const > boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false>, > 2> Skipper=boost::spirit::x3::standard::space_type, > 2> Attribute=const boost::spirit::x3::unused_type > 2> ] > 2> /path/to/tests/rfc\Rfc3986_Uri_BoostSpiritParsing.cpp(44): note: > see reference to function template instantiation 'bool > boost::spirit::x3::phrase_parse<std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>,const > Rule,boost::spirit::x3::standard::space_type>(Iterator > &,Iterator,const Parser &,const Skipper > &,boost::spirit::x3::skip_flag)' being compiled > 2> with > 2> [ > 2> Rule=const > boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false>, > 2> > Iterator=std::_String_const_iterator<std::_String_val<std::_Simple_types<char>>>, > 2> Parser=const > boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false>, > 2> Skipper=boost::spirit::x3::standard::space_type > 2> ] > 2> /path/to/tests/rfc\Rfc3986_Uri_BoostSpiritParsing.cpp(52): note: > see reference to function template instantiation 'void > Kmsg::VerifyRule<Rule>(const std::string &,Rule &,bool)' being > compiled > 2> with > 2> [ > 2> Rule=const > boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false> > 2> ] > 2> /path/to/tests/rfc\Rfc3986_Uri_BoostSpiritParsing.cpp(330): note: > see reference to function template instantiation 'void > Kmsg::VerifyPort<const > boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false>>(const > int32_t,Rule &,bool)' being compiled > 2> with > 2> [ > 2> Rule=const > boost::spirit::x3::rule<Kmsg::IPv4::Port,uint16_t,false> > 2> ] > ========== Build: 1 succeeded, 1 failed, 2 up-to-date, 0 skipped ========== > > > Cheers, > > Michael Powell ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot