<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/103644>103644</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang 19 regression with mismatched parameter packs in fold expanded constraint
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
c++26,
regression:19
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
CaseyCarter
</td>
</tr>
</table>
<pre>
Compiling this well-formed program:
```c++
template <class...>
using void_t = void;
template <class...>
struct tuple {};
template <class Tuple1, class Tuple2>
struct helper {};
template <class... Types1, class... Types2>
requires (requires { typename void_t<Types1, Types2>; } && ...)
struct helper<tuple<Types1...>, tuple<Types2...>> {
using type = void;
};
template <class>
concept False = false;
template <class First, class... Rest>
struct tuple<First, Rest...> : private tuple<Rest...> {
template <False Other>
friend auto f(const tuple&, const Other&) -> helper<tuple, Other>::type;
};
template <class... Types1, class... Types2>
void_t<void_t<Types1, Types2>...> f(const tuple<Types1...>&, const tuple<Types2...>&);
int main() {
using T = tuple<int, int>;
f(T{}, T{});
}
```
with clang 19.1.0-rc2 in `-std=c++26` mode diagnoses:
```
repro.cpp:9:55: error: pack expansion contains parameter packs 'Types1' and 'Types2' that have different lengths (1 vs. 2)
9 | (requires { typename void_t<Types1, Types2>; } && ...)
| ~~~~~~ ~~~~~~ ^
repro.cpp:19:12: note: while checking constraint satisfaction for class template partial specialization 'helper<int, int, int>' required here
19 | friend helper<tuple, Other>::type f(const tuple&, const Other&) {}
| ^~~~~~
repro.cpp:19:12: note: during template argument deduction for class template partial specialization 'helper<tuple<Types1...>, tuple<Types2...>>'
[with Types1 = <int>, Types2 = <int, int>]
repro.cpp:19:12: note: in instantiation of template class 'helper<tuple<int>, tuple<int, int>>' requested here
repro.cpp:28:5: note: while substituting deduced template arguments into function template 'f' [with Other = T]
28 | f(T{}, T{});
| ^
1 error generated.
```
The current release versions of the "big 3" compile this program just fine (https://godbolt.org/z/e71q4Eqhr), as does Clang 19.1.0-rc2 in c++20 and c++23 modes.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVs-Po7gS_mucS6kRlENIDjmkSef6pKe-PzlQgGfAMLbJvJ7D_u0rm19JOrud0S5CAgq7XPXVV58tjJGlItqz-JXFx5XobdXqfSoMfaRCW9Krc5t_7NO26WQtVQm2kgZ-Ul2_FK1uKIdOt6UWDeMHFh5ZeGCbcLgzhq_u9lZLTVcLS8B4mtXCmCAIGH8bfvbGeb60Mv-fBcaP_pXxceoTDozVfWbB9l1NwJJXlhy_mg7vbnDEMIWrb7x3WVHdkX7SZxAE8P7RkVnczqbFMwCAph-91GSA4XZ5T17BfnSkREMjGoyni8PFD38FlhyB4YbhBhwSuHsQNuOph2T2MmKGKdzYcbTzN5_oHOVQFxfSg6p8DceccdaqjDoLJ1GbwVXh3r4s0UlqY2-g_C8Z-7DqjKfzaDdoyAgYP0Cn5cW5ncZd_77O9nr9IdL_2MqBONWt0JJUDqK3LRQMt1mrzLS8q0QKg2WY5iw7eHHL3FUD08UzPzB-cAj_DrDP8Wxm0N9RaQTiPp17wlxl95A5Ptm7sKWy0AipGG4dEg-Y9e65MDmUylfPPTzFJ9QZbt_H_nORT6-7G8RupWf4_Clt5dBRJUS7IArCF50hSAVsE74YmzN-HDUKN2wTQtPmBLkUpWoNmc-CNnxq6nQbZF3H-GHH-CGOHclI61Z7tonsO9D_O6GMbJXDzAqpDHRCi4YsaT_CNX4ylSMBofLZgM5gK2GhEhcXT1GQJmWhJlXayktGBBcTAM5d7yB1CKf_up6Av5znP_wF83P8E799hiVyuETo4FCtJff8WcmaIKso--4q76mkhaOIEVaaQmTWwVW0epTjmfSd0FaKGkxHmRS1_CX8SIbJ3FZXzFkIhMmksjlUpGnOJxqQctfY0c_059MdP_LzDj0Wv3ncngIr77UX3gkCocu-cRTIKe__CVC_uRswTG7yiF99Sw2zfe-O4A9ehtnX9qUa8fGpzKUCqYwVyso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