]> granicus.if.org Git - clang/commitdiff
Make sure that the search for visible declarations looks into the semantic parents...
authorDouglas Gregor <dgregor@apple.com>
Fri, 1 Jan 2010 17:44:25 +0000 (17:44 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 1 Jan 2010 17:44:25 +0000 (17:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92397 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaLookup.cpp
test/FixIt/typo.cpp

index 1419ceb4b660e8bb4efdcffc88c825efad7cdcbb..b86b31896c82daf613ac3cd43caa162048ac8d7a 100644 (file)
@@ -1966,8 +1966,7 @@ static void LookupVisibleDecls(Scope *S, LookupResult &Result,
     return;
 
   DeclContext *Entity = 0;
-  if (S->getEntity() && 
-      !((DeclContext *)S->getEntity())->isFunctionOrMethod()) {
+  if (S->getEntity()) {
     // Look into this scope's declaration context, along with any of its
     // parent lookup contexts (e.g., enclosing classes), up to the point
     // where we hit the context stored in the next outer scope.
index 581cd25f9ab2bcd390d9557d66ce49bcd22aa569..041b86a7f2c7b6d7dfa78764fd72d414fc5e81ab 100644 (file)
@@ -40,4 +40,14 @@ struct Derived : public Base {
 
   Derived() : base(), // expected-error{{initializer 'base' does not name a non-static data member or base class; did you mean the base class 'Base'?}}
               ember() { } // expected-error{{initializer 'ember' does not name a non-static data member or base class; did you mean the member 'member'?}}
+
+  int getMember() const {
+    return ember; // expected-error{{use of undeclared identifier 'ember'; did you mean 'member'?}}
+  }
+
+  int &getMember();
 };
+
+int &Derived::getMember() {
+  return ember; // expected-error{{use of undeclared identifier 'ember'; did you mean 'member'?}}
+}