Here\'s the sample code:
X * makeX(int index) { return new X(index); }
struct Tmp {
mutable int count;
Tmp() : count(0) {}
const X ** getX() const {
Because it this case, the ,
is NOT a sequence point, but acts more like a delimiter in the initialization of the elements of the array.
In other words, you're modifying the same variable twice in a statement without sequence points (between the modifications).
EDIT: thanks to @MikeSeymour: this is an issue in C++03
an before. It seems like in C++11
, the order of evaluation is defined for this case.