[clang] [Sema] Preserve ContainsUnexpandedParameterPack in TransformLambdaExpr (PR #86265)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 24 08:58:45 PDT 2024


ilya-biryukov wrote:

> This patch resolves it by visiting the body twice (of course, it's suboptimal), however patch #99882 still crashes because that relies on the mechanism above, I believe.

I have also observed it crashes, but I still think that in principle we don't need to traverse the body twice. If `DeclStmt` calls `DiagnoseUnexpandedPacks`, it will set the correct flag on the inner `LambdaScopeInfo`, which should later be available in the `LambdaExpr` itself, and can either be "consumed" by `CXXFoldExpr` (as in the example test case) or propagated into the outer `LamdaScopeInfo` from another call to `DiagnoseUnexpandedPacks`.
I believe that's what's already happening during parsing, but we seem to somehow miss setting this flag during substitution.

Are we crashing because we are missing calls to `DiagnoseUnexpandedPacks` during substitution or because we don't set up the `LambdaScopeInfo` during substitution correctly?

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


More information about the cfe-commits mailing list