[clang] [clang] Do not substitute parameter pack while retaining the pack expansion (PR #108197)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 11 05:59:26 PDT 2024
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
More information about the cfe-commits
mailing list