[cfe-commits] r160490 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/enum-scoped.cpp

Aaron Ballman aaron at aaronballman.com
Thu Jul 19 04:23:20 PDT 2012


On Wed, Jul 18, 2012 at 11:13 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Wed, Jul 18, 2012 at 8:12 PM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
>>
>> Author: aaronballman
>> Date: Wed Jul 18 22:12:23 2012
>> New Revision: 160490
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=160490&view=rev
>> Log:
>> Relaxed enumeration constant naming rules for scoped enumerators so they
>> no longer emit a diagnostic when the enumeration's name matches that of the
>> class.  Fixes PR13128.
>>
>> Modified:
>>     cfe/trunk/lib/Sema/SemaDecl.cpp
>>     cfe/trunk/test/SemaCXX/enum-scoped.cpp
>>
>> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=160490&r1=160489&r2=160490&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jul 18 22:12:23 2012
>> @@ -10406,15 +10406,21 @@
>>      }
>>    }
>>
>> -  // C++ [class.mem]p13:
>> -  //   If T is the name of a class, then each of the following shall have
>> a
>> -  //   name different from T:
>> -  //     - every enumerator of every member of class T that is an
>> enumerated
>> -  //       type
>> +  // C++ [class.mem]p15:
>> +  // If T is the name of a class, then each of the following shall have a
>> name
>> +  // different from T:
>> +  // - every enumerator of every member of class T that is an unscoped
>> +  // enumerated type
>> +  //
>> +  // C++ [dcl.enum]p10:
>> +  // Each enum-name and each unscoped enumerator is declared in the scope
>> that
>> +  // immediately contains the enum-specifier. Each scoped enumerator is
>> declared
>> +  // in the scope of the enumeration.
>
>
> Is this quotation relevant here? (Sorry for not calling this out before.)

I thought it was due to the scoping rules that the name is declared
within the scope of the enumeration.  But I can also see it being
superfluous.  I'm happy to remove it if you'd prefer.

~Aaron



More information about the cfe-commits mailing list