This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: bug report
- To: zuchman <zuchman at epitera dot com>
- Subject: Re: bug report
- From: sidster <patrick at boxsoft dot com>
- Date: Thu, 9 Nov 2000 03:04:13 -0800
- Cc: gcc at gcc dot gnu dot org
- References: <3A0A6966.5B38756@epitera.com>
* zuchman (zuchman@epitera.com) [20001109 01:14]:
> 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 :
I wonder... why do you say that?
To the best of my knowledge the signature of operator++() and
operator++(int) are:
13.5.7 Increment and decrement
[...]
class X {
public:
X& operator++(); // prefix ++a
X operator++(int); // postfix a++
};
Besides...i am not too sure why you say the following code should not be
legal. I beleive it does produce the expected result/output:
0, 1, 30, 40, 50
> #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)
patrick
p.s., then again it is 3 AM here...
--
when i grow up i want to be a famous rock'n roll guitar player
-- steve vai