Reading from and writing to the variable (via the post-increment) used to have undefined behaviour, because the = did not introduce a sequence point. You could have received either behaviour (or none, or explosions) in C++14.
Now, there is a sequencing order defined for this case and your C++17 results are reliable.
Although it’s still bad, unclear code that should not be written!