|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2005-03-10 10:53:54
Inline ...
Martin Wille wrote:
>
> I now get these errors for gcc 2.95.3:
>
> regress.cpp:88: invalid operands `const
> boost::foreach_detail_::auto_any_base &' and `int' to binary `operator !='
As I mentioned, gcc 2.95 accepts BOOST_FOREACH in some onstructs but not
others. In particular, the compiler chokes when BOOST_FOREACH is in a
function template, like above. Simpler uses are fine. I'd gladly accept
a patch, but I'm not inclined to waste much more of my time on this
ancient compiler.
>
> gcc-4 without #defines:
>
> /boost/head-regression/boost/boost/iterator/counting_iterator.hpp:32:
> error: '(bool)(boost::is_integral<char>::value)' is not a valid template
> argument for type 'bool' because it is a non-constant expression
> ../../../boost/foreach.hpp:281: error: '(size_t)((-1))' is not a valid
> template argument for type 'unsigned int' because it is a non-constant
> expression
Whoa. This is some pretty basic, legal C++ that gcc-4 is choking on. Has
gcc-4 been released yet? If not, I'm going to wait for it to stabilize a
bit.
>
> gcc 3.2.3 without defines:
>
> regress.cpp: In function `std::vector<int, std::allocator<int> >
> to_vector_foreach_byval(Range&) [with Range = int[5]]':
> regress.cpp:132: instantiated from here
> regress.cpp:88: no match for `bool ? boost::foreach_detail_::rvalue_probe :
> int[5]' operator
I'm guessing that defining BOOST_FOREACH_NO_CONST_RVALUE_DETECTION makes
this go away? That's probably the right fix. It looks like gcc-3.2 is
choking on the fancy rvalue detection stuff. I'll fix this.
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk