Make sure that the search for visible declarations looks into the semantic parents of out-of-line function contexts

llvm-svn: 92397
This commit is contained in:
Douglas Gregor 2010-01-01 17:44:25 +00:00
parent 3f8f44757f
commit 4f2486353a
2 changed files with 11 additions and 2 deletions

View 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.

View 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'?}}
}