[cfe-commits] r92397 - in /cfe/trunk: lib/Sema/SemaLookup.cpp test/FixIt/typo.cpp

Douglas Gregor dgregor at apple.com
Fri Jan 1 09:44:25 PST 2010


Author: dgregor
Date: Fri Jan  1 11:44:25 2010
New Revision: 92397

URL: http://llvm.org/viewvc/llvm-project?rev=92397&view=rev
Log:
Make sure that the search for visible declarations looks into the semantic parents of out-of-line function contexts

Modified:
    cfe/trunk/lib/Sema/SemaLookup.cpp
    cfe/trunk/test/FixIt/typo.cpp

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=92397&r1=92396&r2=92397&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri Jan  1 11:44:25 2010
@@ -1966,8 +1966,7 @@
     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.

Modified: cfe/trunk/test/FixIt/typo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/typo.cpp?rev=92397&r1=92396&r2=92397&view=diff

==============================================================================
--- cfe/trunk/test/FixIt/typo.cpp (original)
+++ cfe/trunk/test/FixIt/typo.cpp Fri Jan  1 11:44:25 2010
@@ -40,4 +40,14 @@
 
   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'?}}
+}





More information about the cfe-commits mailing list