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

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 23 08:33:56 PDT 2024


zyn0217 wrote:

I think somehow we still need an extra bit in `Stmt` to carry over the unexpanded info because a body could contain other statements e.g. `DeclStmt` other than full expressions that could propagate up the unexpanded flag through calls to `ContainsUnexpandedParameterPack()`. For example, in one of my test cases:

```cpp
template <class T>
struct identity {
  using type = T;
};


template <class = void> void f() {
  []<class... Is>(Is...) {
    ([] {
      using T = identity<Is>::type;
    }(), ...);
  }(1, 2);
}

template void f(); // #instantiate-f
```

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.

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


More information about the cfe-commits mailing list