<div class="gmail_quote">On Thu, Jul 19, 2012 at 4:23 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Wed, Jul 18, 2012 at 11:13 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>
> On Wed, Jul 18, 2012 at 8:12 PM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com">aaron@aaronballman.com</a>><br>
> wrote:<br>
>><br>
>> Author: aaronballman<br>
>> Date: Wed Jul 18 22:12:23 2012<br>
>> New Revision: 160490<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=160490&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=160490&view=rev</a><br>
>> Log:<br>
>> Relaxed enumeration constant naming rules for scoped enumerators so they<br>
>> no longer emit a diagnostic when the enumeration's name matches that of the<br>
>> class. Fixes PR13128.<br>
>><br>
>> Modified:<br>
>> cfe/trunk/lib/Sema/SemaDecl.cpp<br>
>> cfe/trunk/test/SemaCXX/enum-scoped.cpp<br>
>><br>
>> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=160490&r1=160489&r2=160490&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=160490&r1=160489&r2=160490&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)<br>
>> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jul 18 22:12:23 2012<br>
>> @@ -10406,15 +10406,21 @@<br>
>> }<br>
>> }<br>
>><br>
>> - // C++ [class.mem]p13:<br>
>> - // If T is the name of a class, then each of the following shall have<br>
>> a<br>
>> - // name different from T:<br>
>> - // - every enumerator of every member of class T that is an<br>
>> enumerated<br>
>> - // type<br>
>> + // C++ [class.mem]p15:<br>
>> + // If T is the name of a class, then each of the following shall have a<br>
>> name<br>
>> + // different from T:<br>
>> + // - every enumerator of every member of class T that is an unscoped<br>
>> + // enumerated type<br>
>> + //<br>
>> + // C++ [dcl.enum]p10:<br>
>> + // Each enum-name and each unscoped enumerator is declared in the scope<br>
>> that<br>
>> + // immediately contains the enum-specifier. Each scoped enumerator is<br>
>> declared<br>
>> + // in the scope of the enumeration.<br>
><br>
><br>
> Is this quotation relevant here? (Sorry for not calling this out before.)<br>
<br>
</div></div>I thought it was due to the scoping rules that the name is declared<br>
within the scope of the enumeration. But I can also see it being<br>
superfluous. I'm happy to remove it if you'd prefer.</blockquote><div><br></div><div>I'd prefer it removed. This quotation would be relevant if the rule were 'no name declared directly within a class can have the same name as the class', but that's not the rule; the rule is what's in p15. (In particular, note the special case in p16.)</div>
</div>