Under MinGW with gcc 3.4.2 I'm having reverse_iterator problems with std::list.
My first example below fails to compile, and my second example compiles but runs incorrectly. I was going to attach the .ii files but bugzilla doesn't seem to allow attachments and the .ii files are rather large. So here as text are the very short .cpp files which include only standard headers. $ type g++ g++ is hashed (/mingw/bin/g++) $ g++ -v Reading specs from c:/devel/mingw/bin/../lib/gcc/mingw32/3.4.2/specs Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.2 (mingw-special) $ g++ -save-temps testrit1.cpp -otestrit1 testrit1.cpp: In function `int main(int, char**)': testrit1.cpp:39: error: no match for 'operator!=' in 'creverse != std::list<_Tp, _Alloc>::rend() [with _Tp = int, _Alloc = std::allocator<int>]()' $ g++ -save-temps testrit2.cpp -otestrit2 $ testrit2 7 8 IMPOSSIBLE //////////// testrit1.cpp #include <iostream> #include <list> using namespace std; int main( int argc, char *argv[] ) { list<int> mylist; mylist.push_back(1); mylist.push_back(2); mylist.push_back(3); mylist.push_back(4); list<int>::iterator forward; list<int>::reverse_iterator reverse; list<int>::const_iterator cforward; list<int>::const_reverse_iterator creverse; // forward for( forward = mylist.begin(); forward != mylist.end(); ++forward ) cout << *forward << endl; cout << endl; // reverse for( reverse = mylist.rbegin(); reverse != mylist.rend(); ++reverse ) cout << *reverse << endl; cout << endl; // cforward for( cforward = mylist.begin(); cforward != mylist.end(); ++cforward ) cout << *cforward << endl; cout << endl; // creverse for( creverse = mylist.rbegin(); creverse != mylist.rend(); ++creverse ) cout << *creverse << endl; cout << endl; return 0; } //////////// testrit2.cpp #include <iostream> #include <list> using namespace std; int main( int argc, char *argv[] ) { list<int> mylist; mylist.push_back(1); mylist.push_back(2); mylist.push_back(3); mylist.push_back(4); mylist.push_back(5); mylist.push_back(6); mylist.push_back(7); mylist.push_back(8); mylist.push_back(9); list<int>::iterator forward; list<int>::reverse_iterator reverse; reverse = mylist.rbegin(); ++reverse; ++reverse; cout << *reverse << endl; forward = reverse.base(); cout << *forward << endl; if( *forward != *reverse ) cout << "IMPOSSIBLE" << std::endl; return 0; } -- Summary: reverse_iterator problems with g++ 3.4.2 Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: major Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: shawn dot yarbrough at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24274