[cfe-commits] r131102 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/tag-ambig.cpp

Douglas Gregor dgregor at apple.com
Mon May 9 14:46:33 PDT 2011


Author: dgregor
Date: Mon May  9 16:46:33 2011
New Revision: 131102

URL: http://llvm.org/viewvc/llvm-project?rev=131102&view=rev
Log:
Extend the tag-ambiguity hack I committed in r130810 for tag
definitions to also include tag declarations. Fixes PR8151.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaCXX/tag-ambig.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=131102&r1=131101&r2=131102&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon May  9 16:46:33 2011
@@ -6763,7 +6763,8 @@
     // shouldn't be diagnosing.
     LookupName(Previous, S);
 
-    if (Previous.isAmbiguous() && TUK == TUK_Definition) {
+    if (Previous.isAmbiguous() && 
+        (TUK == TUK_Definition || TUK == TUK_Declaration)) {
       LookupResult::Filter F = Previous.makeFilter();
       while (F.hasNext()) {
         NamedDecl *ND = F.next();
@@ -6771,9 +6772,6 @@
           F.erase();
       }
       F.done();
-      
-      if (Previous.isAmbiguous())
-        return 0;
     }
     
     // Note:  there used to be some attempt at recovery here.

Modified: cfe/trunk/test/SemaCXX/tag-ambig.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/tag-ambig.cpp?rev=131102&r1=131101&r2=131102&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/tag-ambig.cpp (original)
+++ cfe/trunk/test/SemaCXX/tag-ambig.cpp Mon May  9 16:46:33 2011
@@ -15,3 +15,14 @@
   struct Point { };
   virtual bool testMethod (Test::Point& p) = 0;
 };
+
+// PR8151
+namespace A { struct Face {}; }
+namespace B { struct Face {}; }
+using namespace A;
+using namespace B;
+ 
+class C {
+  struct Face;
+  Face *mFaces;
+};





More information about the cfe-commits mailing list