public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "h2+bugs at fsfe dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/109425] New: mismatched argument pack lengths while expanding
Date: Wed, 05 Apr 2023 19:53:58 +0000	[thread overview]
Message-ID: <bug-109425-4@http.gcc.gnu.org/bugzilla/> (raw)

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!

             reply	other threads:[~2023-04-05 19:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05 19:53 h2+bugs at fsfe dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109425-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).