regardless of the definition of f (which may be unknown for compiler). There is no legal way to modify reference x.ref after its initialization so that it would refer to a different location. Even if we overwrite the storage of x by construction of a new object of type X at address &x (our f could do such thing), a compiler may assume that x.ref is untouched. The same applies to the original example with optional.