This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bug report


Peace!

I want to report a bug in the stl iterators.
the bug is in the operator++(int), which should to return const data or else this example code is
legal :
 

#include <list>
#include <iostream>

using namespace std;

int main(int argc, char* argv[]){

 list<int> l;
 
 l.push_back(0);
 l.push_back(1);
 l.push_back(30);
 l.push_back(40);
 l.push_back(50);
 
 for (list<int>::iterator i = l.begin();i != l.end(); i++++)
  cout << *i << endl;

 return 0;

}
 

 _Self operator++(int) {
    _Self __tmp = *this;
    ++*this;
    return __tmp;
  }

should be :

  const  _Self operator++(int) {
    _Self __tmp = *this;
    ++*this;
    return __tmp;
  }
 

-- 
Horrible Zuchman :)
Epitera
03 - 7318001 (ext 319)
 
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]