<br><br><div class="gmail_quote">On Wed, Mar 27, 2013 at 1:47 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="HOEnZb"><div class="h5">On Mar 27, 2013, at 4:34 PM, Dan Gohman <<a href="mailto:dan433584@gmail.com">dan433584@gmail.com</a>> wrote:<br>
<br>
><br>
><br>
> On Wed, Mar 27, 2013 at 12:16 PM, Howard Hinnant <<a href="mailto:hhinnant@apple.com">hhinnant@apple.com</a>> wrote:<br>
> 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>
> The original code is not undefined behavior.<br>
><br>
> 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?<br>
<br>
</div></div>There is not an allowance for the vendor to let it happen.  Such an allowance would look like the one for insert(p, i, j):<br>
<br>
> pre: i and j are not iterators into a.<br></blockquote><div><br></div><div>Makes sense. I've now reverted the original patch. Thanks!</div><div><br></div><div>Dan</div><div> </div></div>