Consider these situations:

int a = 0;
int b = a++ + a++;
int c = (a++) + (a++);
int d = a++ + (a++);
int e = (a++) + a++;

b == c == d == e == 0.  I understand based on a previous bug about sequence
points in C++ but I think a common-sense approach takes precident here.  If 'a'
were a user-defined class with the operator++ (postfix), how could the user
mimic such behaviour, namely b == c == d == e == 0?  In fact they couldn't.  The
proper solution is then to have b == c == d == e == 1.

-- 
           Summary: Increment/decrement
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: d_picco at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to