This is undefined behavior, right? Double assignment in the same sequence point?
int i = 0;
i = ++i;
This is undefined behavior, right? Double assignment in the same sequence point?
int i = 0;
i = ++i;
i = ++i;
is undefined in all C++ standards prior to C++11.
Note that cohorts of similar expressions using the postfix increments are not defined until C++17.
Both are defined if ++
is overloaded, which is a moot point here as the incrementee is a primitive.