public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97246] New: [10.1 regression] mismatched argument pack lengths
@ 2020-09-29 17:59 wjwray at gmail dot com
  2020-09-30  6:16 ` [Bug c++/97246] [10/11 " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: wjwray at gmail dot com @ 2020-09-29 17:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97246

            Bug ID: 97246
           Summary: [10.1 regression] mismatched argument pack lengths
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wjwray at gmail dot com
  Target Milestone: ---

A deduced <typename... T> argument pack T... v now gives a
"mismatched argument pack lengths" error for T... and v...

i.e. static_assert( sizeof...(T) == sizeof...(v) ); // Fail !!

Here's a sample, working on 9.3, rejected since 10.1
https://godbolt.org/z/oM9ve5

  template <int... Is, typename T>
  T arg_T(decltype(Is)..., T, ...);

  template <int I, int... Is>
  inline constexpr auto get =
   []<typename... T>(decltype(Is)..., T... v, ...) {
     static_assert( sizeof...(T) == sizeof...(v) );
     if constexpr ( sizeof...(T) == 1 )
       return (v,...);
     else {
       using V = decltype(arg_T<__integer_pack(I)...>(v...));
       return get<I,__integer_pack(I)...>.template operator()<V>(v...);
     }
   };

   static_assert( get<0>('\0', short{1}, 2, long{3}) == 0 );

(Will try to simplify & post a reduced sample in a later comment).

Note: the 'mismatched length' error shows when both T and v are used together
e.g. with forwarding references <typename... T> : (T&&... v) : ((T&&)v...)

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

end of thread, other threads:[~2022-05-12 21:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 17:59 [Bug c++/97246] New: [10.1 regression] mismatched argument pack lengths wjwray at gmail dot com
2020-09-30  6:16 ` [Bug c++/97246] [10/11 " rguenth at gcc dot gnu.org
2020-09-30  6:36 ` [Bug c++/97246] [10/11 regression] mismatched argument pack lengths since r10-7865-gaedd04caa945260e marxin at gcc dot gnu.org
2020-10-12 11:47 ` rguenth at gcc dot gnu.org
2021-02-11 23:11 ` jason at gcc dot gnu.org
2021-02-12  2:47 ` cvs-commit at gcc dot gnu.org
2021-02-27 20:43 ` [Bug c++/97246] [10 " cvs-commit at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2022-05-12 21:03 ` jason 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).