[clang] [Sema] Fix computations of "unexpanded packs" in substituted lambdas (PR #99882)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 22 08:25:24 PDT 2024


================
@@ -353,7 +353,11 @@ Sema::DiagnoseUnexpandedParameterPacks(SourceLocation Loc,
       }
 
       if (!EnclosingStmtExpr) {
-        LSI->ContainsUnexpandedParameterPack = true;
+        // It is ok to have unexpanded packs in captures, template parameters
+        // and parameters too, but only the body statement does not store this
+        // flag, so we have to propagate it through LamdaScopeInfo.
+        if (LSI->AfterParameterList)
+          LSI->BodyContainsUnexpandedParameterPack = true;
----------------
zyn0217 wrote:

Yeah, one thing I didn't notice in #86265 is that we could propagate up the unexpanded pack flag for statements through calls to `DiagnoseUnexpandedParameterPacks()`. (IIUC we call this function at the end of every expressions?)

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


More information about the cfe-commits mailing list