[clang] [clang][Sema] Don't assert non-empty unexpanded packs following Colle… (PR #69224)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 21 05:36:02 PDT 2023
zyn0217 wrote:
Sorry for my late update - I've had a busy week ;)
> I don't think so as they don't have parameter or capture list
+1. and it looks like we don't allow expanding a pack outside a statement expression, which more or less prevents the appearance of `FunctionParmPackExpr`.
> 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.
Instead of putting it inside an assertion, how about adding a check for FunctionParmPackExpr separately? I mean,
```cpp
if (auto *Expr = dyn_cast<FunctionParmPackExpr>(E); Expr && getEnclosingLambda())
return false;
```
to bail out only inside the `Expr` overload of `DiagnoseUnexpandedParameterPack`. (since it's the one being called anyways during template instantiation.)
https://github.com/llvm/llvm-project/pull/69224
More information about the cfe-commits
mailing list