<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Mar 20, 2013, at 4:26 PM, Alexander Zinenko <<a href="mailto:ftynse@gmail.com">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 style="">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="mailto: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; position: static; z-index: auto; ">

<div style="word-wrap:break-word"><div class="im"><div>On Mar 14, 2013, at 8:47 AM, Alexander Zinenko <<a href="mailto: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 style="">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></body></html>