[clang] [clang][Sema] Handle function parameter packs in `PackDeductionScope::addPacks` (PR #215235)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 17 20:55:42 PDT 2026
================
@@ -935,6 +935,11 @@ class PackDeductionScope {
S.collectUnexpandedParameterPacks(Pattern, Unexpanded);
for (unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
unsigned Depth, Index;
+
+ // Function parameter packs cannot be deduced.
+ if (isa_and_nonnull<ParmVarDecl>(
+ dyn_cast<NamedDecl *>(Unexpanded[I].first)))
+ continue;
----------------
zwuis wrote:
Sorry that my previous explanation is incomplete. Here is an example where `Unexpanded[i].first` can be anything other than `NamedDecl *` of the `PointerUnion`.
```cpp
template <typename...> struct S1 {};
template <typename... Ts>
struct S2 {
template <typename... Us>
auto f(S1<__builtin_dedup_pack<Ts...>...>,
S1<__builtin_dedup_pack<Us...>...>) -> S1<Us...>;
};
void g(S2<int> s) { s.f<int>(); }
```
https://github.com/llvm/llvm-project/pull/215235
More information about the cfe-commits
mailing list