ilya-biryukov wrote:

Other than the test, the idea of the change does seem correct, here's the 
relevant comment from `Sema.h`:
```cpp
/// The current index into pack expansion arguments that will be
/// used for substitution of parameter packs.
///
/// The pack expansion index will be -1 to indicate that parameter packs
/// should be instantiated as themselves. Otherwise, the index specifies
/// which argument within the parameter pack will be used for substitution.
int ArgumentPackSubstitutionIndex;
```

It looks clear that when `RetainExpansion == true`, we would like the behavior 
that `ArgumentPackSubstitutionIndex == -1` produces. And given that we already 
forget the particular partially substituted pack, it's no surprise that using 
`ArgumentPackSubstitutionIndex` gives us an out-of-bounds access.

Maybe there are certain intricacies I am not getting, but I believe your 
direction to put this into `ForgetPartiallySubstitutedPackRAII` is the right 
way forward.

cc @zygoloid @shafik @cor3ntin in case they want to chime in.

https://github.com/llvm/llvm-project/pull/108197
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to