If I understand the C++17 standard correctly then function arguments should be indeterminately sequenced (P0145R3). Please consider the following testcase:
#include <stdio.h>
void foo(int a, int b, int c) { printf("%d %d %d\n", a, b, c); }
int main() {
int i = 0;
foo(++i, ++i, ++i);
}
clang warns incorrectly:
warning: multiple unsequenced modifications to 'i' [-Wunsequenced]
and prints: 1 2 3
gcc also warns:
warning: operation on ‘i’ may be undefined [-Wsequence-point]
and prints: 3 3 3
Which output is correct?