I get a long list of compile warnings when trying to use boost::xpressive
; specifically when I use sregex_compiler
's compile()
function.
I followed the documentation and put together this small program:
#include <iostream>
#include <boost/xpressive/xpressive.hpp>
using namespace std;
int main (int argc, char **argv)
{
bool matchResult;
boost::xpressive::sregex_compiler compiler;
boost::xpressive::sregex re;
string str("hello world");
re = compiler.compile("hello"); // <-- this line causes warnings
matchResult = boost::xpressive::regex_search(str, re);
cout << "match result = " << matchResult << endl;
return 0;
}
When I compile, I get this long stack of warnings:
$ g++ -I /usr/local/include -o simple xpressive_simple.cc
/usr/local/include/boost/xpressive/detail/core/matcher/alternate_matcher.hpp: In instantiation of 'boost::xpressive::detail::alternate_matcher<boost::xpressive::detail::alternates_vector<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >':
/usr/local/include/boost/xpressive/regex_compiler.hpp:284: instantiated from 'boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_alternates(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:212: instantiated from 'boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compile_(FwdIter, FwdIter, boost::xpressive::regex_constants::syntax_option_type, std::forward_iterator_tag) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:120: instantiated from 'boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compile(InputIter, InputIter, boost::xpressive::regex_constants::syntax_option_type) [with InputIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:139: instantiated from 'boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compile(const typename boost::iterator_value<Iterator>::type*, boost::xpressive::regex_constants::syntax_option_type) [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
xpressive_simple.cc:13: instantiated from here
/usr/local/include/boost/xpressive/detail/core/matcher/alternate_matcher.hpp:88: warni开发者_运维知识库ng: comparison between 'enum boost::xpressive::detail::alternates_vector<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::<anonymous>' and 'enum mpl_::size_t<1073741822ul>::<anonymous>'
/usr/local/include/boost/numeric/conversion/detail/meta.hpp: In instantiation of 'boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_signed> >':
/usr/local/include/boost/mpl/if.hpp:67: instantiated from 'boost::mpl::if_<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_signed> >, boost::mpl::identity<boost::numeric::convdetail::subranged_SameSign<unsigned char, int> >, boost::mpl::eval_if<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned> >, boost::mpl::identity<boost::numeric::convdetail::subranged_Sig2Unsig<unsigned char, int> >, boost::mpl::if_<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, unsigned_to_signed> >, boost::numeric::convdetail::subranged_Unsig2Sig<unsigned char, int>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int> > > >'
/usr/local/include/boost/mpl/eval_if.hpp:37: instantiated from 'boost::mpl::eval_if<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_signed> >, boost::mpl::identity<boost::numeric::convdetail::subranged_SameSign<unsigned char, int> >, boost::mpl::eval_if<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned> >, boost::mpl::identity<boost::numeric::convdetail::subranged_Sig2Unsig<unsigned char, int> >, boost::mpl::if_<boost::numeric::convdetail::equal_to<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, unsigned_to_signed> >, boost::numeric::convdetail::subranged_Unsig2Sig<unsigned char, int>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int> > > >'
/usr/local/include/boost/numeric/conversion/detail/meta.hpp:82: instantiated from 'boost::numeric::convdetail::ct_switch4<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_signed>, mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, mpl_::integral_c<boost::numeric::sign_mixture_enum, unsigned_to_signed>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int>, boost::numeric::convdetail::subranged_Sig2Unsig<unsigned char, int>, boost::numeric::convdetail::subranged_Unsig2Sig<unsigned char, int>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int> >'
/usr/local/include/boost/numeric/conversion/detail/sign_mixture.hpp:63: instantiated from 'boost::numeric::convdetail::for_sign_mixture<mpl_::integral_c<boost::numeric::sign_mixture_enum, signed_to_unsigned>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int>, boost::numeric::convdetail::subranged_Sig2Unsig<unsigned char, int>, boost::numeric::convdetail::subranged_Unsig2Sig<unsigned char, int>, boost::numeric::convdetail::subranged_SameSign<unsigned char, int> >'
/usr/local/include/boost/numeric/conversion/detail/is_subranged.hpp:164: instantiated from 'boost::numeric::convdetail::get_subranged_Int2Int<unsigned char, int>'
/usr/local/include/boost/numeric/conversion/detail/is_subranged.hpp:186: instantiated from 'boost::numeric::convdetail::get_subranged_BuiltIn2BuiltIn<unsigned char, int>'
/usr/local/include/boost/numeric/conversion/detail/is_subranged.hpp:208: instantiated from 'boost::numeric::convdetail::get_subranged<unsigned char, int>'
/usr/local/include/boost/numeric/conversion/detail/is_subranged.hpp:227: instantiated from 'boost::numeric::convdetail::get_is_subranged<unsigned char, int>'
/usr/local/include/boost/numeric/conversion/detail/conversion_traits.hpp:37: instantiated from 'boost::numeric::convdetail::non_trivial_traits_impl<unsigned char, int>'
/usr/local/include/boost/numeric/conversion/conversion_traits.hpp:23: instantiated from 'boost::numeric::conversion_traits<unsigned char, int>'
/usr/local/include/boost/xpressive/detail/dynamic/parse_charset.hpp:85: instantiated from 'boost::xpressive::detail::escape_value<typename boost::iterator_value<Iterator>::type, typename CompilerTraits::regex_traits::char_class_type> boost::xpressive::detail::parse_escape(FwdIter&, FwdIter, CompilerTraits&) [with FwdIter = const char*, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:726: instantiated from 'boost::xpressive::detail::escape_value<typename boost::iterator_value<Iterator>::type, typename RegexTraits::char_class_type> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_escape(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:522: instantiated from 'boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_atom(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:589: instantiated from 'boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_quant(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:622: instantiated from 'boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_sequence(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:281: instantiated from 'boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::parse_alternates(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:212: instantiated from 'boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compile_(FwdIter, FwdIter, boost::xpressive::regex_constants::syntax_option_type, std::forward_iterator_tag) [with FwdIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
/usr/local/include/boost/xpressive/regex_compiler.hpp:120: instantiated from 'boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compile(InputIter, InputIter, boost::xpressive::regex_constants::syntax_option_type) [with InputIter = const char*, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
<snipped>
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:90: instantiated from 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match(boost::xpressive::detail::match_state<BidiIter>&, const Next&) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<true>, boost::xpressive::detail::basic_chset<char> > >, Greedy = mpl_::bool_<true>]'
/usr/local/include/boost/xpressive/detail/dynamic/dynamic.hpp:80: instantiated from 'bool boost::xpressive::detail::dynamic_xpression<Matcher, BidiIter>::match(boost::xpressive::detail::match_state<BidiIter>&) const [with Matcher = boost::xpressive::detail::simple_repeat_matcher<boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<true>, boost::xpressive::detail::basic_chset<char> > >, mpl_::bool_<true> >, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]'
xpressive_simple.cc:18: instantiated from here
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:97: warning: comparison between 'enum boost::xpressive::detail::quant_style<quant_fixed_width, 1ul, true>::<anonymous>' and 'enum mpl_::size_t<1073741822ul>::<anonymous>'
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp: In member function 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match_(boost::xpressive::detail::match_state<BidiIter>&, const Next&, boost::xpressive::detail::greedy_slow_tag) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::basic_chset<char> > >, Greedy = mpl_::bool_<true>]':
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:90: instantiated from 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match(boost::xpressive::detail::match_state<BidiIter>&, const Next&) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::basic_chset<char> > >, Greedy = mpl_::bool_<true>]'
/usr/local/include/boost/xpressive/detail/dynamic/dynamic.hpp:80: instantiated from 'bool boost::xpressive::detail::dynamic_xpression<Matcher, BidiIter>::match(boost::xpressive::detail::match_state<BidiIter>&) const [with Matcher = boost::xpressive::detail::simple_repeat_matcher<boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::basic_chset<char> > >, mpl_::bool_<true> >, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]'
xpressive_simple.cc:18: instantiated from here
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:97: warning: comparison between 'enum boost::xpressive::detail::quant_style<quant_fixed_width, 1ul, true>::<anonymous>' and 'enum mpl_::size_t<1073741822ul>::<anonymous>'
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp: In member function 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match_(boost::xpressive::detail::match_state<BidiIter>&, const Next&, boost::xpressive::detail::greedy_slow_tag) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<true>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, Greedy = mpl_::bool_<true>]':
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:90: instantiated from 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match(boost::xpressive::detail::match_state<BidiIter>&, const Next&) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<true>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, Greedy = mpl_::bool_<true>]'
/usr/local/include/boost/xpressive/detail/dynamic/dynamic.hpp:80: instantiated from 'bool boost::xpressive::detail::dynamic_xpression<Matcher, BidiIter>::match(boost::xpressive::detail::match_state<BidiIter>&) const [with Matcher = boost::xpressive::detail::simple_repeat_matcher<boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<true>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, mpl_::bool_<true> >, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]'
xpressive_simple.cc:18: instantiated from here
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:97: warning: comparison between 'enum boost::xpressive::detail::quant_style<quant_fixed_width, 1ul, true>::<anonymous>' and 'enum mpl_::size_t<1073741822ul>::<anonymous>'
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp: In member function 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match_(boost::xpressive::detail::match_state<BidiIter>&, const Next&, boost::xpressive::detail::greedy_slow_tag) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, Greedy = mpl_::bool_<true>]':
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:90: instantiated from 'bool boost::xpressive::detail::simple_repeat_matcher<Xpr, Greedy>::match(boost::xpressive::detail::match_state<BidiIter>&, const Next&) const [with BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Next = boost::xpressive::detail::matchable_ex<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Xpr = boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, Greedy = mpl_::bool_<true>]'
/usr/local/include/boost/xpressive/detail/dynamic/dynamic.hpp:80: instantiated from 'bool boost::xpressive::detail::dynamic_xpression<Matcher, BidiIter>::match(boost::xpressive::detail::match_state<BidiIter>&) const [with Matcher = boost::xpressive::detail::simple_repeat_matcher<boost::xpressive::detail::matcher_wrapper<boost::xpressive::detail::charset_matcher<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, mpl_::bool_<false>, boost::xpressive::detail::compound_charset<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > > > >, mpl_::bool_<true> >, BidiIter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]'
xpressive_simple.cc:18: instantiated from here
/usr/local/include/boost/xpressive/detail/core/matcher/simple_repeat_matcher.hpp:97: warning: comparison between 'enum boost::xpressive::detail::quant_style<quant_fixed_width, 1ul, true>::<anonymous>' and 'enum mpl_::size_t<1073741822ul>::<anonymous>'
What am I doing in the program that's causing these warnings to show up?
Edit: I'm using boost version 1.43 and g++ version 4.2.1.
Boost 1.47 and g++ 4.4.3 does not give any warnings for your code, even with -Wall and -Wextra. The most likely explanation is the version of boost you're using is older, and since that release the xpressive developers have fixed a number of warnings.
That said, if you (like we do) compile with extremely aggressive warning levels large chunks of boost will still produce a lot of warnings. Our workaround for this is to use "warning suppression" headers with g++ that look a bit like this:
#ifdef __GNUC__
#pragma GCC system_header
#endif
#include <boost/xpressive/xpressive.hpp>
we normally place this file in a directory called nowarnings/boost/xpressive/xpressive.hpp
and include that file to suppress warnings from the boost header.
精彩评论