[clang] [clang] Fix crash when declaring invalid lambda member (PR #74110)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 22:11:21 PST 2024


================
@@ -1526,10 +1526,9 @@ bool CXXRecordDecl::isGenericLambda() const {
 
 #ifndef NDEBUG
 static bool allLookupResultsAreTheSame(const DeclContext::lookup_result &R) {
-  for (auto *D : R)
-    if (!declaresSameEntity(D, R.front()))
-      return false;
-  return true;
+  return llvm::all_of(R, [&](NamedDecl *D) {
+    return D->isInvalidDecl() || declaresSameEntity(D, R.front());
+  });
----------------
shafik wrote:

>From what I can tell nowhere is checking what they pass to `declaresSameEntity(...)` but I did not dig too deeply to see if we know they are valid earlier in some way.

https://github.com/llvm/llvm-project/pull/74110


More information about the cfe-commits mailing list