The next code, should show int the screen "a:2 b:3"; but shows "a:3 b:3".
I have tested it into several versions from 3.3 to 4.0. Always the same result.

void foo(int a,int b)
{
  std::cout<<"a:"<<a<<" b:"<<b<<std::endl;
}

int main()
{
  int n=2;
  foo(n,++n);
}

-- 
           Summary: Compiler fails when using and incrementing a variable i:
                    f(i,++i)  equivalent to f(i+1,i+1); ++i
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jandres at dsic dot upv dot es
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to