Full name of submitter (unless configured in github; will be published with the issue): Jim X
Consider this example:
int f(int i){
return i;
}
int main(){
int i = 0;
auto r = f(i++) + i;
}
GCC reports no warning about unsequenced while Clang does. [intro.execution] p11 says:
When invoking a function f (whether or not the function is inline), every argument expression and the postfix expression designating f are sequenced before every precondition assertion of the function call ([expr.call]), which in turn are sequenced before every expression or statement in the body of f, which in turn are sequenced before every postcondition assertion of the function call.
This wording sounds like the evaluations of argument expressions occur within the function invocation, so their evaluation cannot interleave with those evaluations that don't occur within the function invocation. IIUC, the evaluation of i++ should be indeterminately sequenced with the value computation of the right operand i. However, there is an implementation divergence here.
Suggested Resolution:
Full name of submitter (unless configured in github; will be published with the issue): Jim X
Consider this example:
GCC reports no warning about unsequenced while Clang does. [intro.execution] p11 says:
This wording sounds like the evaluations of argument expressions occur within the function invocation, so their evaluation cannot interleave with those evaluations that don't occur within the function invocation. IIUC, the evaluation of
i++should be indeterminately sequenced with the value computation of the right operandi. However, there is an implementation divergence here.Suggested Resolution: