[Bug c++/49679] New: Increment/decrement operator (++/--) not working as expected

jordan_2000 at hotmail dot de gcc-bugzilla@gcc.gnu.org
Fri Jul 8 17:52:00 GMT 2011


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

           Summary: Increment/decrement operator (++/--) not working as
                    expected
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jordan_2000@hotmail.de


#include <cstdlib>

#include <iostream>



using namespace std;



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

{

    int a=2;

    int b=2;

    a+=++a+a++;
    b+=++b+b++;
    cout << "a=" << a << endl << "b=" << b << endl;

    cin >> a;
    return EXIT_SUCCESS;

}


result

a=4
b=10



More information about the Gcc-bugs mailing list