]> granicus.if.org Git - clang/commitdiff
Fix PR clang/3291
authorDouglas Gregor <dgregor@apple.com>
Wed, 7 Jan 2009 21:36:02 +0000 (21:36 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 7 Jan 2009 21:36:02 +0000 (21:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61886 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/SemaCXX/qualified-id-lookup.cpp

index 49719ab4f524979c414ec53cba9835d3bdf94a5b..351694c74d1ac1b1f01843a21cde9e2d3fc6a2c8 100644 (file)
@@ -343,11 +343,11 @@ Decl *Sema::LookupDecl(DeclarationName Name, unsigned NSI, Scope *S,
           }
         }
         
+        if (!LookInParent && !Ctx->isTransparentContext())
+          return 0;
+
         Ctx = Ctx->getParent();
       }
-      
-      if (!LookInParent && !Ctx->isTransparentContext())
-        return 0;
     }
   }
 
index 0ef8e69107bfca028d615f63ee7992da732df2ec..c0d1ca370d13178dcabf6e0152a01702b08889e9 100644 (file)
@@ -1,5 +1,4 @@
 // RUN: clang -fsyntax-only -verify %s 
-
 namespace Ns {
   int f(); // expected-note{{previous declaration is here}}
 
@@ -71,5 +70,18 @@ namespace a {
   }
 }
 
+// PR clang/3291
+namespace a {  
+  namespace a {   // A1
+    namespace a { // A2
+      int i;
+    }
+  }
+}
 
+void test_a() {
+  a::a::i = 3; // expected-error{{no member named 'i'}}
+  a::a::a::i = 4;
+}
+