So why is i = ++i + 1 well-defined in C++11?

… or a value computation using the value of the same scalar object …

The important part is bolded here. The left hand side does not use the value of i for the value computation. What is being computed is a glvalue. Only afterwards (sequenced after), the value of the object is touched and replaced.

Unfortunately this is a very subtle point 🙂

Leave a Comment