[clang] [clang][Interp] Reject static lambdas with captures (PR #74718)

Ben Jackson via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 11 23:34:20 PST 2023


================
@@ -61,6 +61,11 @@ ByteCodeEmitter::compileFunc(const FunctionDecl *FuncDecl) {
       MD->getParent()->getCaptureFields(LC, LTC);
 
       for (auto Cap : LC) {
+        // Static lambdas cannot have any captures. If this one does,
+        // it has already been diagnosed and we can only ignore it.
+        if (MD->isStatic())
----------------
puremourning wrote:

Not sure we need to even enter this loop. 

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


More information about the cfe-commits mailing list