Opened 9 years ago

Last modified 9 years ago

#8857 new Bugs

Compile error in boost range when trying to use boost string split

Reported by: Blair Jennings <blair.jennings@…> Owned by: Marshall Clow
Milestone: To Be Determined Component: algorithm
Version: Boost 1.54.0 Severity: Problem
Keywords: string split Cc:

Description

I am trying to replace some old string split code with the string split algorithm, but am getting compile errors. OS CentOs 6.3, Boost 1.53 and 1.54 gcc 4.8.1 without -std=c++ parameter. I have done an extensive search and tried multiple possible fixes and the error still occurs.

Here is the error:

In file included from /opt/boost_1_53/boost/range/concepts.hpp:21:0,

from XXXX.C:37:

/opt/boost_1_53/boost/range/begin.hpp: In instantiation of 'typename boost::range_iterator<C>::type boost::range_detail::range_begin(C&) [with C = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<C>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]': /opt/boost_1_53/boost/range/begin.hpp:119:27: required from 'typename boost::range_iterator<const T>::type boost::range_adl_barrier::begin(const T&) [with T = boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<const T>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/range/iterator_range_core.hpp:56:64: required from 'static IteratorT boost::iterator_range_detail::iterator_range_impl<IteratorT>::adl_begin(ForwardRange&) [with ForwardRange = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; IteratorT = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/range/iterator_range_core.hpp:198:45: required from 'boost::iterator_range<IteratorT>::iterator_range(const Range&, boost::iterator_range_detail::const_range_tag) [with Range = boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; IteratorT = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/range/iterator_range_core.hpp:564:63: required from 'boost::iterator_range<typename boost::range_iterator<const T>::type> boost::make_iterator_range(const ForwardRange&) [with ForwardRange = boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<const T>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/range/as_literal.hpp:93:50: required from 'boost::iterator_range<typename boost::range_iterator<C>::type> boost::range_detail::make_range(T&, long int) [with T = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<C>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/range/as_literal.hpp:109:74: required from 'boost::iterator_range<typename boost::range_iterator<const T>::type> boost::as_literal(const Range&) [with Range = boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<const T>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/algorithm/string/iter_find.hpp:153:115: required from 'SequenceSequenceT& boost::algorithm::iter_split(SequenceSequenceT&, RangeT&, FinderT) [with SequenceSequenceT = std::vector<std::basic_string<char> >; RangeT = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; FinderT = boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<char> >]' /opt/boost_1_53/boost/algorithm/string/split.hpp:149:69: required from 'SequenceSequenceT& boost::algorithm::split(SequenceSequenceT&, RangeT&, PredicateT, boost::algorithm::token_compress_mode_type) [with SequenceSequenceT = std::vector<std::basic_string<char> >; RangeT = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; PredicateT = boost::algorithm::detail::is_any_ofF<char>]' XXXX.C:1287:60: required from here /opt/boost_1_53/boost/range/begin.hpp:49:24: error: 'const struct boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >' has no member named 'begin'

return c.begin();

make[2]: Leaving directory `/for_blair/workspace/bluemax3/libcommon/src/common' In file included from /opt/boost_1_53/boost/range/concepts.hpp:22:0,

from XXXX.C:37:

/opt/boost_1_53/boost/range/end.hpp: In instantiation of 'typename boost::range_iterator<C>::type boost::range_detail::range_end(C&) [with C = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<C>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]': /opt/boost_1_53/boost/range/end.hpp:113:25: required from 'typename boost::range_iterator<const T>::type boost::range_adl_barrier::end(const T&) [with T = boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<const T>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/range/iterator_range_core.hpp:62:62: required from 'static IteratorT boost::iterator_range_detail::iterator_range_impl<IteratorT>::adl_end(ForwardRange&) [with ForwardRange = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; IteratorT = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' make[1]: Leaving directory `/for_blair/workspace/bluemax3/libcommon/src' /opt/boost_1_53/boost/range/iterator_range_core.hpp:198:74: required from 'boost::iterator_range<IteratorT>::iterator_range(const Range&, boost::iterator_range_detail::const_range_tag) [with Range = boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; IteratorT = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/range/iterator_range_core.hpp:564:63: required from 'boost::iterator_range<typename boost::range_iterator<const T>::type> boost::make_iterator_range(const ForwardRange&) [with ForwardRange = boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<const T>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/range/as_literal.hpp:93:50: required from 'boost::iterator_range<typename boost::range_iterator<C>::type> boost::range_detail::make_range(T&, long int) [with T = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<C>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/range/as_literal.hpp:109:74: required from 'boost::iterator_range<typename boost::range_iterator<const T>::type> boost::as_literal(const Range&) [with Range = boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<const T>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]' /opt/boost_1_53/boost/algorithm/string/iter_find.hpp:153:115: required from 'SequenceSequenceT& boost::algorithm::iter_split(SequenceSequenceT&, RangeT&, FinderT) [with SequenceSequenceT = std::vector<std::basic_string<char> >; RangeT = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; FinderT = boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<char> >]' /opt/boost_1_53/boost/algorithm/string/split.hpp:149:69: required from 'SequenceSequenceT& boost::algorithm::split(SequenceSequenceT&, RangeT&, PredicateT, boost::algorithm::token_compress_mode_type) [with SequenceSequenceT = std::vector<std::basic_string<char> >; RangeT = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; PredicateT = boost::algorithm::detail::is_any_ofF<char>]' XXXX.C:1287:60: required from here /opt/boost_1_53/boost/range/end.hpp:50:26: error: 'const struct boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >' has no member named 'end'

return c.end();

In file included from /opt/boost_1_53/boost/range/concepts.hpp:21:0,

from XXXX.C:37:

/opt/boost_1_53/boost/range/begin.hpp: In function 'typename boost::range_iterator<C>::type boost::range_detail::range_begin(C&) [with C = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<C>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]': /opt/boost_1_53/boost/range/begin.hpp:50:5: warning: control reaches end of non-void function [-Wreturn-type]

}

In file included from /opt/boost_1_53/boost/range/concepts.hpp:22:0,

from XXXX.C:37:

/opt/boost_1_53/boost/range/end.hpp: In function 'typename boost::range_iterator<C>::type boost::range_detail::range_end(C&) [with C = const boost::sub_match<gnu_cxx::normal_iterator<const char*, std::basic_string<char> > >; typename boost::range_iterator<C>::type = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >]': /opt/boost_1_53/boost/range/end.hpp:51:9: warning: control reaches end of non-void function [-Wreturn-type]

}

Change History (4)

comment:1 by Marshall Clow, 9 years ago

I'm going to need to see some sample code demonstrating the problem.

P.S. How is this different from #8858 ?

comment:2 by anonymous, 9 years ago

As to #8858 it isn't different I accidentally hit something on the page and it resubmitted as an edit.

As to some example code you can just use the standard boost::split example with gcc 4.8.1 as a compiler. It shows the error perfectly.

Blair

comment:3 by Marshall Clow, 9 years ago

Strange. I get no such errors here (tried with clang 3.3, clang 3.4, gcc 4.2.1 and gcc 4.8.1)

$ cd $BOOST/release/libs/algorithm/string/example
$ /Volumes/Bay2/gcc/gcc-4.8.1/bin/bin/g++ split_example.cpp -I $BOOST/release
$
$ /Volumes/Bay2/gcc/gcc-4.8.1/bin/bin/g++ --version
g++ (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

comment:4 by anonymous, 9 years ago

Strange ? ?? You used Clang 3.3 and gcc 4.2 ( how about msvc and xlc and cint and icc )

they all error compile with just this include #include <boost/algorithm/string/split.hpp>

N:\boost_1_54_0\boost/utility/result_of.hpp(170) : error C2065: 'SB' : identificateur non déclaré and so on... for 500 errors

template<typename F> struct is_function_with_no_args<F(void)> : mpl::true_ {}; <-- error C2062: type 'void' unexpected, 'SB' undeclared , undefined 'Fargs' ...

Note: See TracTickets for help on using tickets.