<div dir="ltr">On 13 February 2013 00:53, Nick Lewycky <span dir="ltr"><<a href="mailto:nlewycky@google.com" target="_blank">nlewycky@google.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thinking about this issue more, I'd like to retract this patch. Consider the case where we're implementing the rule that all ODR-used inline functions must have a definition. If Derived::fn is marked inline, we'll see a fictitious use of it and reject a valid translation unit.</div>

</blockquote><div><br></div><div style>Richard talked with me a minute ago and convinced me that this case is impossible (notably, the inline function would need to be pure virtual) and that the original patch I sent out is in fact correct.</div>

<div style><br></div><div style>Nick</div><div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>My next plan is to remove this code from Sema entirely and do the equivalent work inside codegen proper. No reason it can't keep track of probable virtual function targets when writing out a virtual dispatch.<br>

</div><span class="HOEnZb"><font color="#888888">
<div><br></div><div>Nick</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On 12 February 2013 19:30, Nick Lewycky <span dir="ltr"><<a href="mailto:nlewycky@google.com" target="_blank">nlewycky@google.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I failed to produce a concise explanation of the patch, so I'll lead off with the testcase:</div>


<div><br></div><div>  struct Base { virtual void fn() { } };</div><div>  struct Derived : public Base { virtual void fn() = 0;</div>
<div>    void test() { Base::fn(); /* triggers an ODR-use of Derived::fn() */ }</div><div>  };</div><div><br></div><div>This is because we repurpose the odr bit on virtual functions to mean "it would be convenient for codegen to emit this", to help devirtualization for instance. This is implemented in Sema with a scan through all known derived classes when building a member expression, in this case "this->Base::fn". This patch makes that scan skip pure methods.</div>



<div><br></div><div>Patch attached, please review.<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div><br></div><div>Nick</div><div><br></div></font></span></div>

</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>