This is not a compiler bug, but a bug in the STL iterator class.
The less-than-operator does not work properly.
The following program can reproduce the bug.

#  include  <iostream>
#  include  <vector>
using namespace std;

main() {
   vector<int>  v;
   vector<int>::iterator i = v.begin();
   --i;
   cout << ( i - v.begin() )    << endl;  // output: -1
   cout << ( i < v.begin() )    << endl;  // output:  0 !!! SHOULD BE 1 !!!
   cout << ( i - v.begin() < 0) << endl;  // output:  1  this one is correct
}


-- 
           Summary: bug in STL iterator class
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andre dot bergner dot 0 at googlemail dot com
 GCC build triplet: -
  GCC host triplet: -
GCC target triplet: -


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44840

Reply via email to