<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 2016–01–09, at 1:54 AM, Hubert Tong <<a href="mailto:hubert.reinterpretcast@gmail.com" class="">hubert.reinterpretcast@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class="">My two cents: even when memcpy becomes capable of initiating the lifetime of (and initializing) an object in an "aligned_storage blob", the kosher way of accessing that object would require std::launder.<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>Then the question becomes, does <font face="Courier" class="">std::launder</font> require a static type? I was under the impression that it does. In type erasure, <font face="Courier" class="">memcpy</font> needs to support polymorphism.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Now, I am not sure if it is a copy/paste error, my misunderstanding of the code, or what, but it seems that (2) crashes because "&erasure()" and "&storage" overlap (and if the memcpy UB was not enough, it probably does not do what you intended).<br class=""></div></div></div></blockquote><div><br class=""></div><div>Oops, copy-paste error. It should say <font face="Courier" class="">&o.storage</font>. (I just double-checked, the post does differ from the defective test.)</div></div><br class=""><div class="">It’s a good thing you mentioned it, because I ran some more tests and now it looks like an inlining issue, not cleverness in alias analysis. Apparently it works whenever both <font face="Courier" class="">memcpy</font> arguments are function calls; it doesn’t matter what type they cast to.</div><div class=""><br class=""></div><div class="">So, my bugfix didn’t clarify types at all; it merely obfuscated the object identities. The port works, but it’s still as UB as ever.</div><div class=""><br class=""></div></body></html>