[clang] [clang][Sema] Don't assert non-empty unexpanded packs following Colle… (PR #69224)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 16 09:51:30 PDT 2023


cor3ntin wrote:

I think the issue here is that we make the assumption that a full expression cannot contain an unexpanded pack
But that does not hold  for lambda.

Maybe instead of removing the assert entirely we could check whether one of the enclosing scope is a lambda.

While I think the change would be correct, i also think the assert is useful and I'm a bit concerned that removing it entirely will create problems down the line.

so i would encouraging researching 

```cpp
assert((!Unexpanded.empty() || enclosedInAnOtherExpression()) && "Unable to find unexpanded parameter packs");
```

where `enclosedInAnOtherExpression` would try to check that we are in a lambda  - maybe `Sema::getEnclosingLambda()` is sufficient - not sure though.


Can we run into similar problems with statement expressions ? (I don't think so as they don't have parameter or capture list)

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


More information about the cfe-commits mailing list