[cfe-commits] r63647 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/member-name-lookup.cpp test/SemaCXX/using-directive.cpp

Douglas Gregor dgregor at apple.com
Tue Feb 3 11:26:09 PST 2009


Author: dgregor
Date: Tue Feb  3 13:26:08 2009
New Revision: 63647

URL: http://llvm.org/viewvc/llvm-project?rev=63647&view=rev
Log:
When looking for a tag name via unqualified name lookup, only look in
scopes where the name would be considered a redeclaration if we know
that we're declaring or defining that tag.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaCXX/member-name-lookup.cpp
    cfe/trunk/test/SemaCXX/using-directive.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=63647&r1=63646&r2=63647&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Feb  3 13:26:08 2009
@@ -2829,7 +2829,8 @@
     // 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:

Modified: cfe/trunk/test/SemaCXX/member-name-lookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-name-lookup.cpp?rev=63647&r1=63646&r2=63647&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/member-name-lookup.cpp (original)
+++ cfe/trunk/test/SemaCXX/member-name-lookup.cpp Tue Feb  3 13:26:08 2009
@@ -141,6 +141,5 @@
 };
 
 struct HasAnotherMemberType : HasMemberType1, HasMemberType2 { 
-  // FIXME: this is well-formed, but we diagnose an ambiguity here
-  //  struct type { };
+  struct type { };
 };

Modified: cfe/trunk/test/SemaCXX/using-directive.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/using-directive.cpp?rev=63647&r1=63646&r2=63647&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/using-directive.cpp (original)
+++ cfe/trunk/test/SemaCXX/using-directive.cpp Tue Feb  3 13:26:08 2009
@@ -69,6 +69,6 @@
 
 namespace N {
   // FIXME: both of these should work, but they currently cause an ambiguity.
-  // struct K2;
-  // struct K2 { };
+  struct K2;
+  struct K2 { };
 }





More information about the cfe-commits mailing list