<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 14, 2011, at 5:19 PM, Chandler Carruth wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Thu, Jul 14, 2011 at 5:04 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
IMO, the right approach would be to suppress this warning when the constant value itself was instantiated from something... although that's rather trickier to implement.</blockquote></div><br><div>I don't disagree with your premise.... but it does seem much trickier to implement. We don't have the nice type sugar in non-types to indicate that substitution took place. Is it worth adding that for this? Are there other good reasons to add it?</div></blockquote><div><br></div><div>Yes, there are other reasons to add it. For one, it helps us track the correlation between instantiation and definition, but it also leads to a more sane AST for instantiations that's also consistent with the way we handle substitutions of template type and template template parameters. See, for example, the FIXME in Sema::BuildExpressionFromIntegralTemplateArgument regarding enumeration values.</div><br><blockquote type="cite"><div>(Also, this patch seems a strict improvement, and we can add the refined checking you're mentioning as a second step? I'd like to avoid the false positives we were seeing with the previous incarnation)</div>
</blockquote></div><div><br></div>Unless I misunderstood the effect, it also eliminates some true positives as well, in code like<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">      </span>if (dependent-thing && 0)</div><div><br></div><div>so it's not strictly an improvement. I'm not asking to revert it---the patch probably does more good than harm---but I do believe that there is a better solution.<br><div><span class="Apple-tab-span" style="white-space:pre">    </span>- Doug</div></div></body></html>