<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63677>63677</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[rejects valid] pack expansion error in nested generic lambda in variable template
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ericniebler
</td>
</tr>
</table>
<pre>
Compile with `-std=c++20`:
```c++
template <class>
inline constexpr auto fun =
[]<class... Ts>(Ts... ts) {
return [... us = (Ts&&) ts]<class Fun>(Fun&& fn) mutable {
return static_cast<Fun&&>(fn)(static_cast<Ts&&>(us)...);
};
};
int main() {
auto s = fun<int>(1,2,3,4);
}
```
Demo on godbolt: https://godbolt.org/z/Kjq8PEGn1
Result:
```
<source>:6:58: error: pack expansion contains parameter pack 'Ts' that has a different length (1 vs. 4) from outer parameter packs
return static_cast<Fun&&>(fn)(static_cast<Ts&&>(us)...);
~~ ^
<source>:11:20: note: in instantiation of function template specialization '(anonymous class)::operator()<int, int, int, int>' requested here
auto s = fun<int>(1,2,3,4);
^
1 error generated.
```
Expected:
Success
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VEtv4zYQ_jXjyyCCRFoPH3Rw7LiHXop27wVFjWxuKVLLR5rdw_72gmLsOOmilwILCCZpfvPN6xsK79XZEPVQP0J93IgYLtb15JQ0igZNbjPY8Wt_sPOiNOHfKlwQmvLBhxH4UQJ7BPbISmhK4Hsoj1Bef5syf6-Y_G-gedEiEAI_SC28B_6Ub5TRyhBKa3ygl8WhiMHiFA0CP2YIYo7yalsUBX5aGVj3aT0FD2yH0D5eDRAdhehMskyA6BMdrgbAmvXbJbM3VjxFkznTZsXgZBJsjkEMmt7z3zz4IIKSf0rhA_DDzTZTrQTAuvegWwwrJqbgi6JISH7nAdrj2_n-cC1cwFkoA6z7kPxawZzwlHI6KBOyqwrYgQE7cGCH7b2_RP--ffeujjRbtAbPdhysDsD3eAlh8an17ATs9HpRWHcGdvoG7PTr5y_db0-_mOqe53fycTX_oWBej_zgbXSSUsR83wDf113ySM5ZlzaLkH8hvSzCeGVNUk4QynhchBMzBXIZAaxNdW4xXETAi_AocFTTRI5MQE3mnCTNugqffYGpGjg5O6ONmeKezP-0vn__np0g1E8_LEhVAd-zNHVobKC0KoPK-CBMUCKkktgpNV6u-9vk-YWkElp9yxhgLbBOGGu-zjZ6zFOZQtkD39uFnAjWZXG9Sogd8N9LSqVFR18i-UAjXsjR_xDiW95V7jieyaRYaCz-Q6FPLwvJQONNW39EKcn7zdjzccd3YkN91XRdzcq66zaXvhrHahi7bVVT3bT1lrp2aLgY226apnJbb1TPSsbLtqzLiu22XVE1zbSTI9tNsm5lK2Fb0iyULrR-npPyN8r7SH3Dm7bdaDGQ9tfn1fUJ9DDEs4dtqZUP_s0sqKDXh9jRZ5LB47PQaoT6-FHpuR7KoMmlXiujJGoxD6NIF8_CqfWpunZ9E53uP8yqCpc4FNLOwE4piNflYXE2-Qd2WhPxwE5rLv8EAAD__xmKyfo">