[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 08:12:38 PDT 2024


ilya-biryukov wrote:

I have spent some time poking at the code and looking at the debugger and came up with a smaller repro, see https://gcc.godbolt.org/z/6ccPPd6hz:

```cpp
int bar(...);

template <int> struct Int {};

template <class ...T>
constexpr auto foo(T... x) -> decltype(bar(T(x)...)) { return 1; }
template <class ...T>
constexpr auto baz(Int<foo<T>(T())>... x) -> int { return 1; }

static_assert(baz<Int<1>, Int<2>, Int<3>>(Int<1>(), Int<2>(), Int<3>(), Int<4>()) == 1);
```

I hope this helps.

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


More information about the cfe-commits mailing list