Boost logo

Boost :

Subject: [boost] [foreach] Errors using foreach
From: Edward Diener (eldiener_at_[hidden])
Date: 2015-03-03 19:58:03


When trying to use the foreach library, whether running it tests or
trying to build quickbook which uses the foreach macro, I am seeing from
different compilers:

gcc-4.9.2

> In file included from stl_byval.cpp:15:0:
> ./utility.hpp: In function 'bool sequence_equal_byval_n(foreach_container_type&, const char*)':
> ..\..\../boost/foreach.hpp:906:96: error: no matching function for call to 'encode_type(foreach_container_type&, boost::is_const<std::list<int> >*)'
> (true ? 0 : boost::foreach_detail_::encode_type(COL, boost::foreach_detail_::is_const_(COL)))
> ^
> ..\..\../boost/foreach.hpp:1013:9: note: in expansion of macro 'BOOST_FOREACH_TYPEOF'
> , BOOST_FOREACH_TYPEOF(COL) \
> ^
> ..\..\../boost/foreach.hpp:1095:77: note: in expansion of macro 'BOOST_FOREACH_BEGIN'
> if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_BEGIN(COL)) {} else \
> ^
> ./utility.hpp:20:5: note: in expansion of macro 'BOOST_FOREACH'
> BOOST_FOREACH( foreach_value_type i, rng )
> ^

clang

> In file included from stl_byval.cpp:25:
> ././utility.hpp:20:5: error: no matching function for call to 'encode_type'
> BOOST_FOREACH( foreach_value_type i, rng )
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ..\..\..\boost/foreach.hpp:1095:77: note: expanded from macro 'BOOST_FOREACH'
> if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_BEGIN(COL)) {} else \
> ^~~~~~~~~~~~~~~~~~~~~~~~
> ..\..\..\boost/foreach.hpp:1013:9: note: expanded from macro 'BOOST_FOREACH_BEGIN'
> , BOOST_FOREACH_TYPEOF(COL) \
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> ..\..\..\boost/foreach.hpp:906:17: note: expanded from macro 'BOOST_FOREACH_TYPEOF'
> (true ? 0 : boost::foreach_detail_::encode_type(COL, boost::foreach_detail_::is_const_(COL)))
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ..\..\..\boost/foreach.hpp:401:22: note: candidate function [with T = std::list<int, std::allocator<int> >] not viable: no known conversion from 'boost::is_const<list<int, allocator<int> > > *' to 'boost::mpl::false_ *' (aka 'bool_<false> *') for 2nd argument
> inline type2type<T> *encode_type(T &, boost::mpl::false_ *) { return 0; }
> ^
> ..\..\..\boost/foreach.hpp:404:30: note: candidate function [with T = std::list<int, std::allocator<int> >] not viable: no known conversion from 'boost::is_const<list<int, allocator<int> > > *' to 'boost::mpl::true_ *' (aka 'bool_<true> *') for 2nd argument
> inline type2type<T, const_> *encode_type(T const &, boost::mpl::true_ *) { return 0; }
> ^
> In file included from stl_byval.cpp:25:
> ././utility.hpp:20:5: error: no matching function for call to 'encode_type'
> BOOST_FOREACH( foreach_value_type i, rng )
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Does anybody know what is causing this error ? I can't seem to proceed
in building documentation with quickbook until I can get foreach
working. I pulled the latest foreach from the master branch and ran b2
headers but still the problem occurs.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk