I agree with your point about instantiation. <span></span>My example is just another case that should not be checked. And it happens that this is getting done by the same condition "has no complete definition". I added a comment covering all of this anyways. <div>
<br>On Thursday, March 21, 2013, John McCall  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>On Mar 20, 2013, at 4:26 PM, Alexander Zinenko <<a href="javascript:_e({}, 'cvml', 'ftynse@gmail.com');" target="_blank">ftynse@gmail.com</a>> wrote:</div>
<blockquote type="cite"><div dir="ltr"><div>Thanks for your comments and sorry that it's taking so long to polish my code.</div><div>Please find the updated version attached.</div><div class="gmail_extra"><br>

<div class="gmail_quote">On 20 March 2013 07:02, John McCall <span dir="ltr"><<a href="javascript:_e({}, 'cvml', 'rjmccall@apple.com');" target="_blank">rjmccall@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div style="word-wrap:break-word"><div><div>On Mar 14, 2013, at 8:47 AM, Alexander Zinenko <<a href="javascript:_e({}, 'cvml', 'ftynse@gmail.com');" target="_blank">ftynse@gmail.com</a>> wrote:</div>
<blockquote type="cite">

<div dir="ltr"><div>Thanks for review!</div><div><br></div><div>I attached a quiet version of a patch that doesn't warn if any of the paths is a non-virtually-derived base at offset zero.  </div>

<div>During first iteration, Jordan proposed to make a separate switch to enable a noisy version that warns even if the cast is safe, though. If it is still required, it can be easily added back.</div><div>Processing multiple base paths made checking a bit heavier, but I see no other approach.</div>


</div></blockquote><div><br></div></div><div><div>+  if(!SrcRD || !SrcRD->hasDefinition())</div><div>+    return;</div><div>+</div><div>+  const CXXRecordDecl *DestRD = DestType->getPointeeCXXRecordDecl();</div><div>


+</div><div>+  if(!DestRD || !DestRD->hasDefinition())</div><div>+    return;</div><div><br></div><div>Please add a comment saying that we're deliberately not instantiating</div><div>templates here because we're not allowed to.</div>


</div></div></blockquote><div>Actually, we do not call CheckReinterpretCast if the cast is type-dependent.</div></div></div></div></blockquote><div><br></div>I don't see your point.  Whether the cast is type-dependent has nothing to do</div>
<div>with it.  Both arguments could be non-dependent, or we could actually be</div><div>in a non-template context, and it'd still be illegal to instantiate the classes.</div><div>For example:</div><div><br></div><div>
template <class T> class A { T val; };</div><div>class B {};</div><div><br></div><div>B *foo(A<void> *a) {</div><div>  return reinterpret_cast<B*>(a);</div><div>}</div><div><br></div><div>John.</div></div>

</blockquote></div>