[clang] [Clang] incorrect assertion when checking template template parameter of a lambda (PR #138121)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 1 08:04:14 PDT 2025


================
@@ -1696,7 +1696,11 @@ static NamedDecl* getLambdaCallOperatorHelper(const CXXRecordDecl &RD) {
       RD.getASTContext().DeclarationNames.getCXXOperatorName(OO_Call);
 
   DeclContext::lookup_result Calls = RD.lookup(Name);
-  assert(!Calls.empty() && "Missing lambda call operator!");
+
+  // This can happen while building the lambda.
+  if (Calls.empty())
+    return nullptr;
----------------
cor3ntin wrote:

I added an assert, which hinges on the fact that we don't look at the static invoker in cases where the lambda is incomplete.
I agree that having these various states in lambdas is a bit unfortunate, but it is a consequence of P2036.
If you have a better solution, I'm all ears!


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


More information about the cfe-commits mailing list