N1570 states that this is undefined behavior:
§J.2/1 The value of an object with automatic storage duration is used while it is indeterminate (6.2.4
In this expression:
&ptr
the address of the &
operand, i. e., the address of the ptr
object is yielded but the ptr
object is never evaluated.
(C11, 6.3.2.1p2) "Except when it is the operand of the sizeof operator, the unary & operator, the ++ operator, the -- operator, or the left operand of the . operator or an assignment operator, an lvalue that does not have array type is converted to the value stored in the designated object (and is no longer an lvalue); this is called lvalue conversion."