]> granicus.if.org Git - clang/commitdiff
When looking for a tag name via unqualified name lookup, only look in
authorDouglas Gregor <dgregor@apple.com>
Tue, 3 Feb 2009 19:26:08 +0000 (19:26 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 3 Feb 2009 19:26:08 +0000 (19:26 +0000)
scopes where the name would be considered a redeclaration if we know
that we're declaring or defining that tag.

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

lib/Sema/SemaDecl.cpp
test/SemaCXX/member-name-lookup.cpp
test/SemaCXX/using-directive.cpp

index 39747b63ee49631fa098b74cc8147baaae45f564..66b72ecad4f03d5daee151beb24a173a7154659f 100644 (file)
@@ -2829,7 +2829,8 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagKind TK,
     // FIXME: We're looking into outer scopes here, even when we
     // shouldn't be. Doing so can result in ambiguities that we
     // shouldn't be diagnosing.
-    LookupResult R = LookupName(S, Name, LookupTagName);
+    LookupResult R = LookupName(S, Name, LookupTagName,
+                                /*RedeclarationOnly=*/(TK != TK_Reference));
     if (R.isAmbiguous()) {
       DiagnoseAmbiguousLookup(R, Name, NameLoc);
       // FIXME: This is not best way to recover from case like:
index a19161203e14419beceb3297ebda6243f988cce8..f48a99add4d75f889ac697b812861de102d15cec 100644 (file)
@@ -141,6 +141,5 @@ struct HasMemberType2 {
 };
 
 struct HasAnotherMemberType : HasMemberType1, HasMemberType2 { 
-  // FIXME: this is well-formed, but we diagnose an ambiguity here
-  //  struct type { };
+  struct type { };
 };
index f00209863de1b604c6815f98f666b411bae935b1..baf5d5812699d05de5d9ba039104aa9e1e26677b 100644 (file)
@@ -69,6 +69,6 @@ class X {
 
 namespace N {
   // FIXME: both of these should work, but they currently cause an ambiguity.
-  // struct K2;
-  // struct K2 { };
+  struct K2;
+  struct K2 { };
 }