Hello everyone,
Could someone please confirm that the following program is valid:
#include <list>
typedef std::list<intList;
int main()
{
List foo;
foo.push_back(1);
foo.push_back(2);
int accu = 0;
List::const_reverse_iterator it;
for (it = foo.rbegin(); it != foo.rend(); ++it) accu += *it;
return accu;
}
$ g++ -std=c++98 -Wall -Wextra mini.cxx
mini.cxx: In function `int main()':
mini.cxx:10: error: no match for 'operator!=' in 'it != std::list<_Tp,
_Alloc>::rend() [with _Tp = int, _Alloc = std::allocator<int>]()'
AFAIU, this is a compiler bug.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11729
I suppose my version of GCC is starting to show its age.
(3.4.4 was released on 2005-05-18.)
However 3.4.6 (released on 2006-03-06) produces the same error.
I suppose that the appropriate work around is to change
const_reverse_iterator to reverse_iterator?
Regards.