<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>Pinging this myself, adding Richard Smith as another reviewer. I don't quite feel qualified to give the final word on it, but I'm fixing an analyzer bug that's basically "don't crash when the user does this in exactly the <strike>right</strike> wrong way", and it'd be nice to have a warning so that they fix their code.</div><div><br></div><div>Reattaching Alexander's patch.</div><div><br></div><div>Jordan</div><div><br></div><br><div><div>On Feb 11, 2013, at 8:14 , Alexander Zinenko <<a href="mailto:ftynse@gmail.com">ftynse@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Ping?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 28 January 2013 23:03, Alexander Zinenko <span dir="ltr"><<a href="mailto:ftynse@gmail.com" target="_blank">ftynse@gmail.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 dir="ltr">Hello!<div><br></div><div>If this patch is good enough, could someone commit it, please?</div></div><div class="HOEnZb">
<div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On 24 January 2013 21:55, Alexander Zinenko <span dir="ltr"><<a href="mailto:ftynse@gmail.com" target="_blank">ftynse@gmail.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 dir="ltr"><div>On 24 January 2013 04:33, Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><div>
<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><br>
On Jan 23, 2013, at 14:53 , Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>> wrote:<br>
> I think the only reasonable false positive source for zero adjustment</div></blockquote></div><div><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; ">
> case is templates:<br>
><br>
> template<typename T, typename U><br>
> void foo(T *t) {<br>
> ... reinterpret_cast<U*>(t);<br>
> }<br>
><br>
> Where T and U have some subtyping relationship.<br></blockquote><div><br></div></div><div>Warning could be disabled for dependent types. </div><div>Trivial case warning adds an extra note where the template was instantiated, though. As for me it's worth still having it enabled.</div>
<div> </div><div>template.cpp:15:10: warning: 'reinterpret_cast' is used as an upcast from type 'B *' to its base type 'A *' [-Wreinterpret-updown-zero-adjustment]</div><div> (void)*reinterpret_cast<U *>(t);</div>
<div> ^~~~~~~~~~~~~~~~~~~~~~~~</div><div>template.cpp:20:3: note: in instantiation of function template specialization 'foo<B, A>' requested here</div><div> foo<B, A>(&b);</div><div> </div>
</div></div></div></blockquote></div></div></div></div></blockquote></div></div></blockquote></div><div><br></div><div></div></body></html>