On Thu, Jul 19, 2012 at 4:23 AM, Aaron Ballman <[email protected]>wrote:
> On Wed, Jul 18, 2012 at 11:13 PM, Richard Smith <[email protected]> > wrote: > > On Wed, Jul 18, 2012 at 8:12 PM, Aaron Ballman <[email protected]> > > 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. 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.)
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
