[clang] [clang][Sema] Ignore the parentheses in the guard of DiagnoseUnexpandedParameterPack (PR #86401)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 25 19:03:29 PDT 2024


zyn0217 wrote:

> Hmm, actually - does this fix address /other/ ways a pack could appear, like this? https://godbolt.org/z/oez8TbGqM
> 
> Presumably a pack could appear in a variety of expressions, not just wrapped in parens - could be in a function call (as in the above example), or nested arbitrarily more deeply in the expression in any number of other expressions?

It fixes it as well, although with an unused-expression warning.
```cpp
warning: expression result unused [-Wunused-value]
    7 |   [&](auto... indexes) {
      |   ^~~~~~~~~~~~~~~~~~~~~~
    8 |     f1([&] {
      |     ~~~~~~~~
    9 |         (ts);
      |         ~~~~~
   10 |         indexes;
      |         ~~~~~~~~
   11 |       } ...);
      |       ~~~~~~~
   12 |   };
      |   ~
```
Aside: it crashes again if you turn the capture of the inner lambda to a pack, e.g. `ts` - that is a different story and is being tracked in #18873, which indicates that the capture of packs is still broken as of now.

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


More information about the cfe-commits mailing list