]> granicus.if.org Git - clang/commitdiff
When attempting to recover from a failed unqualified name lookup, make
authorDouglas Gregor <dgregor@apple.com>
Mon, 9 Aug 2010 22:38:14 +0000 (22:38 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 9 Aug 2010 22:38:14 +0000 (22:38 +0000)
sure to clear out the LookupResult structure after looking into each class.

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

lib/Sema/SemaExpr.cpp
test/SemaCXX/crash-PR7625.cpp [new file with mode: 0644]

index 96ac69c7ff50e94d46a3bee9919020076b90baf6..d573ca9bbbdf003ddba2e1e32bd86b270d82eeda 100644 (file)
@@ -917,6 +917,8 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
         // Tell the callee to try to recover.
         return false;
       }
+
+      R.clear();
     }
   }
 
diff --git a/test/SemaCXX/crash-PR7625.cpp b/test/SemaCXX/crash-PR7625.cpp
new file mode 100644 (file)
index 0000000..3ddf5e5
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+template<typename T> struct a : T {
+ struct x : T {
+   int aa() { return p; } // expected-error{{use of undeclared identifier 'p'}}
+ };
+};