<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 2, 2016, at 16:20, Richard Smith <<a href="mailto:richard@metafoo.co.uk" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 2, 2016 at 3:51 PM, Jordan Rose via cfe-commits<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;" class=""><div class=""><div class="h5"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 2, 2016, at 15:48, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="m_4103563763562392798Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 2, 2016 at 2:34 PM, Jordan Rose via cfe-commits<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Nov 2, 2016, at 14:31, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="m_4103563763562392798m_-4883782072324447123Apple-interchange-newline"><div class=""><div dir="auto" class=""><div class=""><div class="gmail_extra"><div class="gmail_quote">On 2 Nov 2016 1:53 pm, "Jordan Rose via cfe-commits" <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>> wrote:<br type="attribution" class=""><blockquote class="m_4103563763562392798m_-4883782072324447123quote" 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;">Author: jrose<br class="">Date: Wed Nov  2 15:44:07 2016<br class="">New Revision: 285856<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=285856&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-pr<wbr class="">oject?rev=285856&view=rev</a><br class="">Log:<br class="">Don't require nullability on template parameters in typedefs.<br class=""><br class="">Previously the following code would warn on the use of "T":<br class=""><br class=""> <span class="Apple-converted-space"> </span>template <typename T><br class=""> <span class="Apple-converted-space"> </span>struct X {<br class="">   <span class="Apple-converted-space"> </span>typedef T *type;<br class=""> <span class="Apple-converted-space"> </span>};<br class=""><br class="">...because nullability is /allowed/ on template parameters (because<br class="">they could be pointers). (Actually putting nullability on this use of<br class="">'T' will of course break if the argument is a non-pointer type.)<br class=""></blockquote></div></div></div><div class=""><br class=""></div><div class="">This doesn't make any sense to me. Why would T need to be a pointer type for a nullability qualifier to be valid on a T*?</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Sorry, this is referring to the following change to the example:</div><div class=""><br class=""></div></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><span class=""><div class=""><div class="">template <typename T></div></div><div class=""><div class="">struct X {</div></div></span><div class=""><div class=""> <span class="Apple-converted-space"> </span>typedef T _Nullable *type;</div></div><div class=""><div class="">};</div></div></blockquote><div class=""><div class=""><br class=""></div><div class="">This is legal, but of course `X<int>` then produces an error. So we want to accept nullability in this position (in case T is implicitly required to be a pointer type by the definition of X) but not warn when it’s missing (in case it isn’t).</div></div></div></blockquote><div class=""><br class=""></div><div class="">Oh, I see. Your testcase is very confusing, though, since it wraps the problematic use of T in a completely-unrelated pointer type. The actual problem being fixed is much more obvious in a case like this:</div><div class=""><br class=""></div><div class="">int *_Nullable p;</div><div class="">template<typename T> struct X {</div><div class=""> <span class="Apple-converted-space"> </span>T t; // warns without your fix</div><div class="">};</div><div class=""><br class=""></div><div class="">It'd be easier on future readers of this code to use the more obvious test case here.</div></div></div></div></div></blockquote><br class=""></div></div></div><div class="">Ah, that case doesn’t actually trigger the issue, because a typedef doesn’t require nullability on its outermost pointer type. (It’s assumed that the use site may need to make some uses of the typedef nullable and some non-nullable.)</div></div></blockquote><div class=""><br class=""></div><div class="">The testcase I gave above definitely produces a bogus warning before your patch. I've not actually checked whether the patch fixes it, though.</div><div class=""> </div></div></div></div></div></blockquote><br class=""></div><div>Oops, sorry, I misread it thinking it still said ‘typedef’. Yes, that does warn, and no, this patch does not fix it.</div><div><br class=""></div><div>Jordan</div><br class=""></body></html>