https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109425
Bug ID: 109425
Summary: mismatched argument pack lengths while expanding
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: h2+bugs at fsfe dot org
Target Milestone: ---
The following snippet is rejected by GCC10, GCC11 and GCC12:
```cpp
#include <concepts>
template <typename T1, typename T2>
concept weakly_eq_comparable = requires (T1 t1, T2 t2) { { t1 == t2 } ->
std::convertible_to<bool>; };
template <typename ...Ts>
struct my_tuple
{
template <typename ...T2s>
requires ((sizeof...(Ts) == sizeof...(T2s)) && (weakly_eq_comparable<Ts,
T2s> && ...))
friend bool operator==(my_tuple const & lhs, my_tuple<T2s...> const & rhs)
{
return true;
}
};
int main()
{
my_tuple<int, float> m1;
}
```
See also:
https://godbolt.org/z/3eEjT589o
The error is:
```
<source>: In instantiation of 'struct my_tuple<int, float>':
<source>:20:26: required from here
<source>:11:86: error: mismatched argument pack lengths while expanding
'weakly_eq_comparable<Ts, T2s>'
11 | requires ((sizeof...(Ts) == sizeof...(T2s)) &&
(weakly_eq_comparable<Ts, T2s> && ...))
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
Compiler returned: 1
```
Clang>=13 accepts this code.
I am not sure if this is related to #107853, because I am not getting an ICE,
but it seems like the problems (or their solutions) could be related.
Thank you!