<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 30 May 2013 16:57, Nikolay Ivchenkov <span dir="ltr">&lt;<a href="mailto:mk.ivchenkov@gmail.com" target="_blank">mk.ivchenkov@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><div class="gmail_quote"><div>regardless of the definition of f (which may be unknown for compiler). There is no legal way to modify reference <span style="font-family:courier new,monospace">x.ref</span> 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 &amp;x (our f could do such thing), a compiler may assume that <span style="font-family:courier new,monospace">x.ref</span> is untouched. The same applies to the original example with optional. <br>

</div></div><br></blockquote><div><br></div><div>I see, thanks, that&#39;s a very good explanation. But there&#39;s still the difference that the 3.8/7 would seem to refer to<br>the storage of A inside the optional (in the original example of yours), and we never had a pointer or a reference <br>
to that storage, but we have a reference inside that storage. Same with this latest example of yours, isn&#39;t<br></div><div>explicit destruction and placement-new of x legal, and allowed to modify the reference inside the storage<br>
</div><div>of x? If we had a pointer/reference to that storage previously, we wouldn&#39;t be able to refer to the new<br>object via those, but in the example we do not have such a pointer/reference.<br></div></div></div>
</div>