From: Martin Wille (mw8329_at_[hidden])
Date: 2005-03-10 12:05:28
Eric Niebler wrote:
> 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.
I wouldn't have supported it in the first place :)
>> gcc-4 without #defines:
>> 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
> 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
No it hasn't been released, yet.
>> gcc 3.2.3 without defines:
>> regress.cpp: In function `std::vector<int, std::allocator<int> >
>> to_vector_foreach_byval(Range&) [with Range = int]':
>> regress.cpp:132: instantiated from here
>> regress.cpp:88: no match for `bool ?
>> boost::foreach_detail_::rvalue_probe :
>> int' 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.
Well, I'd consider gcc 3.2 not worth supporting. However, since you
asked for gcc 2.95 in your first message, I thought you might be
interested in the results for gcc 3.2, too.
Yes, the error goes away with BOOST_FOREACH_NO_CONST_RVALUE_DETECTION.
(The very same applies to gcc 3.1 and gcc 3.0.4)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk