--- Comment #9 from mmitchel at gcc dot gnu dot org 2007-04-22 18:49
---
Daniel asked me to look at this issue.
Andrew is correct:
b = a++;
is exactly equivalent to:
b = a.operator++(0);
It is completely up to the operator to implement the postfix semantics; it's
just a functio
--- Comment #8 from drow at gcc dot gnu dot org 2007-04-22 18:49 ---
Subject: Re: postfix increment semantics implemented
incorrectly
On Sun, Apr 22, 2007 at 05:18:09PM -, pinskia at gcc dot gnu dot org wrote:
> 13.5.1/1 explains that:
> @x is the same as operator@(x) or x.
--- Comment #7 from pinskia at gcc dot gnu dot org 2007-04-22 18:18 ---
13.5.1/1 explains that:
@x is the same as operator@(x) or x.operator@() [depending on if x has a member
function for operator@ or not] .
So:
a = b++; is the exactly the same as:
a = b.operator++(0);
so function ope
--- Comment #6 from drow at gcc dot gnu dot org 2007-04-22 17:50 ---
I believe that this bug should not be RESOLVED/INVALID at least until a C++
front end maintainer has looked at it.
--
drow at gcc dot gnu dot org changed:
What|Removed |Added
--- Comment #5 from hayward at loup dot net 2007-04-22 16:37 ---
Subject: Re: postfix increment semantics implemented incorrectly
> Why do you say could blow the stack, the C++ standard actually mentions an
> optimization where the copy constructored is removed and there is no extra
--- Comment #4 from pinskia at gcc dot gnu dot org 2007-04-22 07:03 ---
> Using a copy constructor and returning by value is of limited
> applicability. Having to invoke a copy constructor to "simulate" a
> post rvalue operation is not an option for objects that do not support
> copy, a
--- Comment #3 from hayward at loup dot net 2007-04-22 06:40 ---
Subject: Re: postfix increment semantics implemented incorrectly
Thanks for the quick response. I do not, however, agree with this
interpretation of ISO/IEC FDIS 14882:1998(E) 13.5.7/1.
The spec trivially exemplifies th
--- Comment #2 from pinskia at gcc dot gnu dot org 2007-04-21 23:49 ---
This is not a bug in GCC but instead a bug in your post fix increment operator:
C & operator++( int ) { v += 100; return *this; }
Really should be implemented as:
C operator++( int ) { C tmp = *this; v += 100;