<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54659>54659</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Variadic template constructor not called implicitly
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kamshi
</td>
</tr>
</table>
<pre>
From https://stackoverflow.com/questions/71654148/variadic-template-parameter-pack-expansion-looses-qualifier/71669096#71669096:
```
template <class... Args>
struct S {
template <class... T>
S(T...) {}
};
template <typename... Args>
void callFunc(S<Args...>);
int main() { callFunc<const int>(S<int>{1}); }
```
https://godbolt.org/z/h6eq1od3j
Expected behavior: The given object `S<int>` should be passed to the templated constructor `S<const int>::S<int>`, because it is not marked explicit. Instead, the following error is reported:
```
<source>:10:14: error: no matching function for call to 'callFunc'
int main() { callFunc<const int>(S<int>{}); }
^~~~~~~~~~~~~~~~~~~
<source>:8:6: note: candidate template ignored: could not match 'const int' against 'int'
void callFunc(S<Args...>);
^
1 error generated.
Compiler returned: 1
```
Tested with all versions of clang up to 14.0.0 for x86_64. gcc also doesn't accept this code, msvc does however, but utilizes the implicit copy constructor to do so (in my opinion incorreclty, since `S<int>` and `S<const int>` are two distinct, unrelated types).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVU2PozgQ_TXkYgXxTThw6I9pac7dmuvKmErwtMG0bZLO_Pp9hiSdzEQr7W5EiA1Vr17VK1ca3R7rF6N71jk32iB9CJIXXNZx8a73ZLZKH0Khezz7mMg6qQeLdRkXeRZnGyz33EjeSrF21I-KO1qP3PCeHBmsxPuaPkc-WDiuldaW7Ppj4kpuJZkFqKiiqgiS9LIEieg5iM73Ijpd8_YchQXpk1Dc2jAM2YPZgfu3xcI6MwnHXllQPi5PGD53_d4uTt7kNUg2b3gcJNXsWz6fGGCRPl5zugZzx5EG5PsHj72WLRNcqZdpEIB-hb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