public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109425] New: mismatched argument pack lengths while expanding
@ 2023-04-05 19:53 h2+bugs at fsfe dot org
  2023-04-05 20:16 ` [Bug c++/109425] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: h2+bugs at fsfe dot org @ 2023-04-05 19:53 UTC (permalink / raw)
  To: gcc-bugs

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!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-06 13:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-05 19:53 [Bug c++/109425] New: mismatched argument pack lengths while expanding h2+bugs at fsfe dot org
2023-04-05 20:16 ` [Bug c++/109425] " mpolacek at gcc dot gnu.org
2023-04-05 23:09 ` h2+bugs at fsfe dot org
2023-04-06 13:18 ` mpolacek at gcc dot gnu.org
2023-04-06 13:25 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).