]> granicus.if.org Git - clang/commitdiff
When looking up enumerator names for redeclaration, use the
authorDouglas Gregor <dgregor@apple.com>
Tue, 19 Jan 2010 06:06:57 +0000 (06:06 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 19 Jan 2010 06:06:57 +0000 (06:06 +0000)
ForRedeclaration flag so that we don't look into base classes.
Fixes PR6061.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93862 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/SemaCXX/enum.cpp

index 101cae84be65f05c34067b075d2c868b933b4230..d2ac483db53972623aaf054bab1b4f7862446e10 100644 (file)
@@ -6095,7 +6095,8 @@ Sema::DeclPtrTy Sema::ActOnEnumConstant(Scope *S, DeclPtrTy theEnumDecl,
 
   // Verify that there isn't already something declared with this name in this
   // scope.
-  NamedDecl *PrevDecl = LookupSingleName(S, Id, LookupOrdinaryName);
+  NamedDecl *PrevDecl = LookupSingleName(S, Id, LookupOrdinaryName,
+                                         ForRedeclaration);
   if (PrevDecl && PrevDecl->isTemplateParameter()) {
     // Maybe we will complain about the shadowed template parameter.
     DiagnoseTemplateParameterShadow(IdLoc, PrevDecl);
index f1b02f5d4c6dbb98baf8473e2fa126b95843fc9d..47ae06ab0e6982283bfd294d19a0dc930413a293 100644 (file)
@@ -56,3 +56,14 @@ namespace test1 {
   enum enum4 { v4 = __LONG_MAX__ * 2UL };
   int test4[is_same<__typeof(+v4), unsigned long>::value];
 }
+
+// PR6061
+namespace PR6061 {
+  struct A { enum { id }; };
+  struct B { enum { id }; };
+  
+  struct C : public A, public B
+  { 
+    enum { id }; 
+  };
+}