Even in that case, operator returns a reference, not a value, which still doesn't involve actually evaluating anything. I understand the standard says it's undefined.
Originally Posted by CornedBee
It is not the case that all sub-expressions of an expression must have defined values. If that were the case, the following program would be undefined:
I don't think anybody will dispute the validity of this code. But 'x' does appear as a subexpression in the call to clear_integer(). At the time of the call, it is uninitialized. The "evaluation" of this uninitialized value should trigger undefined behavior according to the above, but I think we all agree that it doesn't. What gets passed is the address of x, not the contents of x.
void clear_integer(int *x)
*x = 0;