]> granicus.if.org Git - clang/commitdiff
Extend the tag-ambiguity hack I committed in r130810 for tag
authorDouglas Gregor <dgregor@apple.com>
Mon, 9 May 2011 21:46:33 +0000 (21:46 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 9 May 2011 21:46:33 +0000 (21:46 +0000)
definitions to also include tag declarations. Fixes PR8151.

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

lib/Sema/SemaDecl.cpp
test/SemaCXX/tag-ambig.cpp

index 71bea3c92d27df177e06bed1355e0c15c4766324..cd6dc9227ee8955b98349b09012022af63be24cc 100644 (file)
@@ -6763,7 +6763,8 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
     // 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 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
           F.erase();
       }
       F.done();
-      
-      if (Previous.isAmbiguous())
-        return 0;
     }
     
     // Note:  there used to be some attempt at recovery here.
index 42cb9604b081ac90f960a95afaad182fdc6fba6f..6403cf30597dd6a45edb32be97949e9bcf886e3b 100644 (file)
@@ -15,3 +15,14 @@ public:
   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;
+};