bug report

zuchman zuchman@epitera.com
Thu Nov 9 01:08:00 GMT 2000


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)
 



More information about the Gcc mailing list