This does seem like a good idea. I'm trying to wrap my head around what this 
means and failing. 'int *a = *a'?

I wouldn't worry about the 'a(b), b(a)' case. Or rather, the issue is that 'b' 
is uninitialized in 'a(b)', and it doesn't really matter if it's given a valid 
initialization later. But the inline field initializer ('int &c = c' in a 
class) would be nice to handle.

I'm not so familiar with this part of Sema, but the diff looks reasonable.

Jordan


On Aug 16, 2012, at 2:36 , Hans Wennborg <[email protected]> wrote:

> Hi all,
> 
> The attached patch makes Clang warn about self-initialization of
> references, like:
> 
>  int &a = a;
> 
> Because that seems like a bad thing to do, and I don't think we should
> suppress it like we do with "int x = x" which is a common way of
> avoiding warnings about unused variables.
> 
> Please take a look.
> 
> Thanks,
> Hans
> <self_init_refs.patch>_______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to