public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113443] New: GCC rejects valid program involving parameter packs with in between class type
@ 2024-01-17 13:38 jlame646 at gmail dot com
  2024-01-18 11:07 ` [Bug c++/113443] " jlame646 at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jlame646 at gmail dot com @ 2024-01-17 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113443
           Summary: GCC rejects valid program involving parameter packs
                    with in between class type
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlame646 at gmail dot com
  Target Milestone: ---

In the following program gcc accepts the call when a built in type object is
passed while rejects the call when a class type object is passed.
https://godbolt.org/z/Ez5oocGrr

```
#include <array>
#include <cstddef>
#include <tuple>
#include <type_traits>
#include <iostream>

struct in_between{};
template <typename... T>
struct args_tag
{

};

template <typename... T>
void bar(args_tag<T...>, std::type_identity_t<T>..., int,
std::type_identity_t<T>...) {}
template <typename... T>
void bar(args_tag<T...>, std::type_identity_t<T>..., in_between,
std::type_identity_t<T>...) {}

// example
int main() { 

     bar(args_tag<int, int>{}, 4, 8, in_between{}, 16, 23); // gcc rejects this 
     //bar(args_tag<int, int>{}, 4, 8, int{}, 16, 23); //GCC accepts this
}
```

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

* [Bug c++/113443] GCC rejects valid program involving parameter packs with in between class type
  2024-01-17 13:38 [Bug c++/113443] New: GCC rejects valid program involving parameter packs with in between class type jlame646 at gmail dot com
@ 2024-01-18 11:07 ` jlame646 at gmail dot com
  2024-01-18 19:12 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jlame646 at gmail dot com @ 2024-01-18 11:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jason Liam <jlame646 at gmail dot com> ---
The explanation for why this is valid is given here:
https://stackoverflow.com/questions/77832658/stdtype-identity-to-support-several-variadic-argument-lists

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

* [Bug c++/113443] GCC rejects valid program involving parameter packs with in between class type
  2024-01-17 13:38 [Bug c++/113443] New: GCC rejects valid program involving parameter packs with in between class type jlame646 at gmail dot com
  2024-01-18 11:07 ` [Bug c++/113443] " jlame646 at gmail dot com
@ 2024-01-18 19:12 ` mpolacek at gcc dot gnu.org
  2024-01-19  5:42 ` jlame646 at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-18 19:12 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
$ xclang++ -c 113443.C -std=c++23
113443.C:22:6: error: no matching function for call to 'bar'
   22 |      bar(args_tag<int, int>{}, 4, 8, in_between{}, 16, 23); // gcc
rejects this 
      |      ^~~
113443.C:17:6: note: candidate template ignored: deduced packs of different
lengths for parameter 'T' (<int, int> vs. <>)
   17 | void bar(args_tag<T...>, std::type_identity_t<T>..., in_between,
std::type_identity_t<T>...) {}
      |      ^
113443.C:15:6: note: candidate template ignored: deduced packs of different
lengths for parameter 'T' (<int, int> vs. <>)
   15 | void bar(args_tag<T...>, std::type_identity_t<T>..., int,
std::type_identity_t<T>...) {}
      |      ^
1 error generated.

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

* [Bug c++/113443] GCC rejects valid program involving parameter packs with in between class type
  2024-01-17 13:38 [Bug c++/113443] New: GCC rejects valid program involving parameter packs with in between class type jlame646 at gmail dot com
  2024-01-18 11:07 ` [Bug c++/113443] " jlame646 at gmail dot com
  2024-01-18 19:12 ` mpolacek at gcc dot gnu.org
@ 2024-01-19  5:42 ` jlame646 at gmail dot com
  2024-01-27 16:02 ` jlame646 at gmail dot com
  2024-01-30 16:37 ` mpolacek at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jlame646 at gmail dot com @ 2024-01-19  5:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Liam <jlame646 at gmail dot com> ---
Clang is also wrong in rejecting the code. Here is the clang bub:
https://github.com/llvm/llvm-project/issues/78449

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

* [Bug c++/113443] GCC rejects valid program involving parameter packs with in between class type
  2024-01-17 13:38 [Bug c++/113443] New: GCC rejects valid program involving parameter packs with in between class type jlame646 at gmail dot com
                   ` (2 preceding siblings ...)
  2024-01-19  5:42 ` jlame646 at gmail dot com
@ 2024-01-27 16:02 ` jlame646 at gmail dot com
  2024-01-30 16:37 ` mpolacek at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jlame646 at gmail dot com @ 2024-01-27 16:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason Liam <jlame646 at gmail dot com> ---
Clang has now fixed the issue https://github.com/llvm/llvm-project/issues/78449

So now only gcc rejects the valid program.

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

* [Bug c++/113443] GCC rejects valid program involving parameter packs with in between class type
  2024-01-17 13:38 [Bug c++/113443] New: GCC rejects valid program involving parameter packs with in between class type jlame646 at gmail dot com
                   ` (3 preceding siblings ...)
  2024-01-27 16:02 ` jlame646 at gmail dot com
@ 2024-01-30 16:37 ` mpolacek at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-30 16:37 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-01-30
     Ever confirmed|0                           |1

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed, then.

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

end of thread, other threads:[~2024-01-30 16:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-17 13:38 [Bug c++/113443] New: GCC rejects valid program involving parameter packs with in between class type jlame646 at gmail dot com
2024-01-18 11:07 ` [Bug c++/113443] " jlame646 at gmail dot com
2024-01-18 19:12 ` mpolacek at gcc dot gnu.org
2024-01-19  5:42 ` jlame646 at gmail dot com
2024-01-27 16:02 ` jlame646 at gmail dot com
2024-01-30 16:37 ` mpolacek 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).