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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu May 1 06:20:34 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;
----------------
erichkeane wrote:

So I'm REALLY concerned about this.  I don't think it is wrong, but just that we need to make sure we handle this value correctly.  At least `getLambdaStaticInvoker` doesn't handle the `nullptr` correctly (though I guess the other two uses DO, so thats fine).

I wouldn't mind a bit of an audit to make sure that uses of `getLambdaStaticInvoker` (and perhaps the others, but as they already acknowledged they could return null, i'm mildly less concerned) do a reasonable thing.

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


More information about the cfe-commits mailing list