<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64902>64902</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang: pack expansion contains parameter pack 'Args' that has a different length (1 vs. 2) from outer parameter packs
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jcelerier
</td>
</tr>
</table>
<pre>
Hello,
repro:
```c++
#include <functional>
struct worker {
std::function<void(int, int)> request;
static void work(int, int);
} worker;
template <typename T = int>
void connect_worker() {
worker.request = []<typename... Args>(Args&&... f) {
[... ff = std::forward<Args>(f)]() mutable {
worker::work(std::forward<Args>(ff)...);
}();
};
}
int main() { connect_worker(); }
```
causes:
```c++
<source>:14:48: error: pack expansion contains parameter pack 'Args' that has a different length (1 vs. 2) from outer parameter packs
worker::work(std::forward<Args>(ff)...);
~~~~ ^
```
I'm confident this is a compiler bug as if one turns "connect_worker" into a non-template by removing `
template <typename T = int>`, then code builds and run as expected:
https://gcc.godbolt.org/z/YM6ar7WG3
also,
static_assert(sizeof...(Args) == 2);
just before the offending line passes too.
Not forwarding the arguments works too:
worker::work(ff...);
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVcFu4zYQ_ZrxZRBBHsqWfdDBceK2h_ZUoOhpQVEjmVmKVEkq2ewh315QVmIlu9gW6KGGIBmk3uObN4-UDEF3lrmCzS1s7lZyjGfnqwfFhr1mv6pd81z9zMY4oCPkd5AfLnfPg3cgDrgchG1-uRTQbbouoyS0VWZsGEEc29GqqJ2VBsT9EhyiH1XEJ-c_s0coZzQiYogNiAOIwysYxPHR6QZop20EOuL02IO4R89_jRwiiHd4GbXCBJn4v8W9Si3vZgHXoekeuR-MjFMF8XlgK3vG3xHE3UTxWsm0gnLWsoqfZiLaAe3f13OZyWapE8ulAQv2LMvw4LuQuGk3_aMt0DaNt98wph9sb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