================ @@ -14636,6 +14645,20 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) { /*IsInstantiation*/ true); SavedContext.pop(); + // Parts other than the capture e.g. the lambda body might still contain a + // pattern that an outer fold expression would expand. + // + // We don't have a way to propagate up the ContainsUnexpandedParameterPack + // flag from a Stmt, so we have to revisit the lambda. + if (!LSICopy.ContainsUnexpandedParameterPack) { + llvm::SmallVector<UnexpandedParameterPack> UnexpandedPacks; + getSema().collectUnexpandedParameterPacksFromLambda(NewCallOperator, + UnexpandedPacks); + // FIXME: Should we call Sema::DiagnoseUnexpandedParameterPacks() instead? + // Unfortunately, that requires the LambdaScopeInfo to exist, which has been + // removed by ActOnFinishFunctionBody(). + LSICopy.ContainsUnexpandedParameterPack = !UnexpandedPacks.empty(); + } ---------------- zyn0217 wrote:
We probably need a refactor here to teach `ActOnFinishFunctionBody()` not to pop the LSI eventually. How about leaving it as an NFC? https://github.com/llvm/llvm-project/pull/86265 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits