https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83028
Bug ID: 83028
Summary: Incorrect -Wsequence-point warning in correct C++17
code with new evaluation order rules
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ixsci at yandex dot ru
Target Milestone: ---
Compiling the following code:
#include <iostream>
using namespace std;
int main()
{
int i = 0;
cout << i++ << " " << i++ << "\n";
};
with the latest gcc (compiled on wandbox.org) and -std=c++1z gives the
following warning:
operation on 'i' may be undefined [-Wsequence-point]
cout << i++ << " " << i++ << "\n";
But there should be no warnings since both modifications are sequenced and the
result is well defined.