<br><br><div class="gmail_quote">On Wed, Mar 27, 2013 at 12:16 PM, Howard Hinnant <span dir="ltr"><<a href="mailto:hhinnant@apple.com" target="_blank">hhinnant@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mar 27, 2013, at 2:44 PM, Dan Gohman <<a href="mailto:dan433584@gmail.com">dan433584@gmail.com</a>> wrote:<br>
<br>
> Author: djg<br>
> Date: Wed Mar 27 13:44:56 2013<br>
> New Revision: 178166<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=178166&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=178166&view=rev</a><br>
> Log:<br>
> Avoid undefined behavior from passing a std::vector's own contents<br>
> in as an argument to push_back.<br>
<br>
</div>The original code is not undefined behavior.<br></blockquote><div><br></div><div>My interpretation was that the push_back could cause reallocation which could invalidate the reference to the old element before it is read. Is there a guarantee that this won't happen?</div>
<div><br></div><div>Dan</div><div><br></div></div>