<div dir="ltr">Patch LGTM.<div><br></div><div>I share your concern that we could do with a more comprehensive check for similar bugs. That said, in this case, it seems to me that the root cause is that a per-Decl 'used' flag doesn't really make much sense in the way we use it now. I think we should either track whether that particular declaration is used (with isUsed scanning the entire redecl chain), or we should only have one flag for the entire redeclaration chain (perhaps by always looking at the flag on either the most recent decl or the canonical decl). Modeling it as "is this declaration or any previous declaration used" is weird, and requires contortions like the loop at the end of Sema::MarkFunctionReferenced.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 22, 2013 at 12:41 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Rebased patch attached.<br>
<div class="HOEnZb"><div class="h5"><br>
On 19 October 2013 18:51, Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br>
> Hi Richard,<br>
><br>
> The attached patch fixes pr17624, but I worry there might be more bugs<br>
> like this. Some analysis must ignore hidden decls so that, for<br>
> example, we accept<br>
><br>
> void f4() {<br>
>   void g4(int a, int b = 7);<br>
>   {<br>
>     void g4(int a, int b = 5);<br>
>   }<br>
>   void g4(int a = 5, int b);<br>
> }<br>
><br>
> but is isUsed really the only check that has to consider the true most<br>
> recent decl?<br>
><br>
> Cheers,<br>
> Rafael<br>
</div></div></blockquote></div><br></div>