[cfe-commits] r162093 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Analysis/stack-addr-ps.cpp test/SemaCXX/convert-to-bool.cpp test/SemaCXX/references.cpp test/SemaCXX/uninitialized.cpp

Hans Wennborg hans at chromium.org
Fri Aug 17 06:56:28 PDT 2012


On Fri, Aug 17, 2012 at 12:10 PM, Chandler Carruth <chandlerc at google.com> wrote:
>> +namespace references {
>> +  int &a = a; // expected-warning{{variable 'a' is uninitialized when
>> used within its own initialization}}
>
> While completely correct (we are initializing the reference to an
> uninitialized reference), I wonder if this will confuse people into thinking
> there is some kind of copy or uninitialized *value* underlying the
> reference... Is there a better / more clear / more specific warning text we
> can use here?
>
> "reference 'a' not yet been bound to a value when used within its own
> initialization"?
> "reference 'a' is unbound when used within its own initialization"?

I like your first suggestion and think it does make the warning
clearer. It annoys me slightly that we'd have to special-case
references when we output the diagnostic (it would look like in the
attached patch), but maybe that's not a big deal.

Thanks,
Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: self_init_refs_wording.patch
Type: application/octet-stream
Size: 4868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120817/24b9e337/attachment.obj>


More information about the cfe-commits mailing list