https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85557

            Bug ID: 85557
           Summary: Incorrect calculation of function arguments with C++17
                    sequencing rules
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ixsci at yandex dot ru
  Target Milestone: ---

Given the following simple code:

#include <iostream>
using namespace std;

int foo(int first, int second)
{
    return first << second;
}

int main()
{
    int i = 0;
    cout << "Result: " << foo(i = 1, i = 2) << "\n";
};

The latest GCC (9.0 tested on Wandbox) with -std=c++17 produces the following
output: "Result: 2" but it should produce "Result: 4" because function
parameters calculations are indeterminately sequenced between each other.

Reply via email to