public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59716] New: variadic template multiple parameter pack expansion fails
@ 2014-01-08  7:15 lts-rudolph at gmx dot de
  2015-04-04  9:27 ` [Bug c++/59716] " paolo.carlini at oracle dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: lts-rudolph at gmx dot de @ 2014-01-08  7:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59716

            Bug ID: 59716
           Summary: variadic template multiple parameter pack expansion
                    fails
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lts-rudolph at gmx dot de

Created attachment 31770
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31770&action=edit
full source code example

Multiple parameter pack expansion for variadic templates is broken since 4.8.x
versions. The parameter pack expansion itself works with g++ 4.7.x. But the
order of expanded parms was wrong. This bug was fixed in 4.8.x but mutiple
expansion is now broken.

The code fails with the follwing results:

/opt/linux-gnu_4.9-20140105/bin/g++ --std=c++11 zwei.cpp -O0 -g -pedantic -Wall
-o go2
zwei.cpp: In instantiation of 'CheckVariadic<std::tuple<_Elements ...>,
std::tuple<_Elements ...> >::CheckVariadic(T1 ..., T2 ..., T1 ...) [with T1 =
{int, float}; T2 = {char, void*}]':
zwei.cpp:53:115:   required from here
zwei.cpp:47:116: error: mismatched argument pack lengths while expanding
'DebugPrinter<T1, T2, T1 ...>'
         CheckVariadic( T1... args1, T2... args2, T1... args3): DebugPrinter<
T1, T2, T1...>(args1, args2..., args1)... {}

The problem occurs in this line of code:
CheckVariadic( T1... args1, T2... args2, T1... args3): DebugPrinter< T1, T2,
T1...>(args1, args2..., args1)... {}

The attachment compiles with clang3.3 & clang3.4 as expected.


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

* [Bug c++/59716] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
@ 2015-04-04  9:27 ` paolo.carlini at oracle dot com
  2015-08-03 11:02 ` lts-rudolph at gmx dot de
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-04-04  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-04-04
     Ever confirmed|0                           |1


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

* [Bug c++/59716] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
  2015-04-04  9:27 ` [Bug c++/59716] " paolo.carlini at oracle dot com
@ 2015-08-03 11:02 ` lts-rudolph at gmx dot de
  2021-08-10  2:27 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: lts-rudolph at gmx dot de @ 2015-08-03 11:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Klaus Rudolph <lts-rudolph at gmx dot de> ---
Bug is still present 2015-08-03 ( sorry, can't change "last reconfirmed"
entry?!


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

* [Bug c++/59716] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
  2015-04-04  9:27 ` [Bug c++/59716] " paolo.carlini at oracle dot com
  2015-08-03 11:02 ` lts-rudolph at gmx dot de
@ 2021-08-10  2:27 ` pinskia at gcc dot gnu.org
  2021-08-10  2:56 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-10  2:27 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 7.4.0+ and GCC 8+.

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

* [Bug c++/59716] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
                   ` (2 preceding siblings ...)
  2021-08-10  2:27 ` pinskia at gcc dot gnu.org
@ 2021-08-10  2:56 ` pinskia at gcc dot gnu.org
  2021-11-26 19:51 ` lts-rudolph at gmx dot de
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-10  2:56 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |7.4

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

* [Bug c++/59716] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
                   ` (3 preceding siblings ...)
  2021-08-10  2:56 ` pinskia at gcc dot gnu.org
@ 2021-11-26 19:51 ` lts-rudolph at gmx dot de
  2021-11-26 21:14 ` [Bug c++/59716] [10/11 Regression] " pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: lts-rudolph at gmx dot de @ 2021-11-26 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

Klaus Rudolph <lts-rudolph at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
             Status|RESOLVED                    |REOPENED

--- Comment #3 from Klaus Rudolph <lts-rudolph at gmx dot de> ---
The attached code again did not compile from gcc 10.x.x

 https://godbolt.org/z/sbej6GeY1

No the error message is:

<source>: In instantiation of 'CheckVariadic<std::tuple<_Tps ...>,
std::tuple<_Types ...> >::CheckVariadic(T1 ..., T2 ..., T1 ...) [with T1 =
{int, float}; T2 = {char, void*}]':
<source>:53:115:   required from here
<source>:47:116: error: invalid use of pack expansion expression
   47 |         CheckVariadic( T1... args1, T2... args2, T1... args3):
DebugPrinter< T1, T2, T1...>(args1, args2..., args1)... {}
      |

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

* [Bug c++/59716] [10/11 Regression] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
                   ` (4 preceding siblings ...)
  2021-11-26 19:51 ` lts-rudolph at gmx dot de
@ 2021-11-26 21:14 ` pinskia at gcc dot gnu.org
  2021-12-09  9:24 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-26 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|variadic template multiple  |[10/11 Regression] variadic
                   |parameter pack expansion    |template multiple parameter
                   |fails                       |pack expansion fails
   Target Milestone|7.4                         |10.4

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Klaus Rudolph from comment #3)
> The attached code again did not compile from gcc 10.x.x
Hmm, it works on the trunk though ...

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

* [Bug c++/59716] [10/11 Regression] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
                   ` (5 preceding siblings ...)
  2021-11-26 21:14 ` [Bug c++/59716] [10/11 Regression] " pinskia at gcc dot gnu.org
@ 2021-12-09  9:24 ` marxin at gcc dot gnu.org
  2021-12-09 14:38 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-09  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |marxin at gcc dot gnu.org
             Status|REOPENED                    |RESOLVED

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed with r8-2715-g11399477539ec605.

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

* [Bug c++/59716] [10/11 Regression] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
                   ` (6 preceding siblings ...)
  2021-12-09  9:24 ` marxin at gcc dot gnu.org
@ 2021-12-09 14:38 ` pinskia at gcc dot gnu.org
  2021-12-09 14:58 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-09 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
         Resolution|FIXED                       |---

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #5)
> Fixed with r8-2715-g11399477539ec605.

But it was broken sometime after that (again).

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

* [Bug c++/59716] [10/11 Regression] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
                   ` (7 preceding siblings ...)
  2021-12-09 14:38 ` pinskia at gcc dot gnu.org
@ 2021-12-09 14:58 ` marxin at gcc dot gnu.org
  2022-04-07  8:39 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-09 14:58 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
You are correct, it started r10-3735-gcb57504a55015891 again and was fixed in
r12-174-g37d2b98100cefcb9.

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

* [Bug c++/59716] [10/11 Regression] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
                   ` (8 preceding siblings ...)
  2021-12-09 14:58 ` marxin at gcc dot gnu.org
@ 2022-04-07  8:39 ` rguenth at gcc dot gnu.org
  2022-04-07  9:29 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-07  8:39 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/59716] [10/11 Regression] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
                   ` (9 preceding siblings ...)
  2022-04-07  8:39 ` rguenth at gcc dot gnu.org
@ 2022-04-07  9:29 ` rguenth at gcc dot gnu.org
  2022-04-07 13:28 ` ppalka at gcc dot gnu.org
  2022-04-30 16:01 ` [Bug c++/59716] " ppalka at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-07  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Patrick, is the bug you fixed and that fixed this testcase a duplicate and thus
a regression?

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

* [Bug c++/59716] [10/11 Regression] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
                   ` (10 preceding siblings ...)
  2022-04-07  9:29 ` rguenth at gcc dot gnu.org
@ 2022-04-07 13:28 ` ppalka at gcc dot gnu.org
  2022-04-30 16:01 ` [Bug c++/59716] " ppalka at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-04-07 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Hmm, this PR is essentially a dup of PR88580 but I don't think it's a 10/11
regression: between r8-2715 and r10-3735 it seems we just went from incorrectly
rejecting the testcase (the behavior before r8-2715) to miscompiling it.  After
r10-3735 we went back to incorrectly rejecting it (arguably an improvement). 
So AFAICT we never correctly handled this testcase before r12-174.


Output when compiled with GCC trunk:

  Construction of: DebugPrinter<Head, T>::DebugPrinter(Y ...) [with Y = {int,
char, void*, int}; Head = int; T = {char, int, float}] Values: 1, c, 0xddddd,
1, 
  Construction of: DebugPrinter<Head, T>::DebugPrinter(Y ...) [with Y = {float,
char, void*, float}; Head = float; T = {void*, int, float}] Values: 2.2, c,
0xddddd, 2.2, 

GCC 10/11 reject the testcase.

Output when compiled with GCC 7.4/8/9 (miscompile):

  Construction of: DebugPrinter<Head, T>::DebugPrinter(Y ...) [with Y = {int,
bool, int}; Head = int; T = {char, int, float}] Values: 1, 0, 1, 
  Construction of: DebugPrinter<Head, T>::DebugPrinter(Y ...) [with Y = {float,
bool, float}; Head = float; T = {void*, int, float}] Values: 2.2, 0, 2.2, 

GCC < 7.4 reject the testcase.

Output when compiled with Clang (equivalent to GCC trunk output):

  Construction of: DebugPrinter<int, char, int, float>::DebugPrinter(Y...)
[Head = int, T = <char, int, float>, Y = <int, char, void *, int>] Values: 1,
c, 0xddddd, 1, 
  Construction of: DebugPrinter<float, void *, int, float>::DebugPrinter(Y...)
[Head = float, T = <void *, int, float>, Y = <float, char, void *, float>]
Values: 2.2, c, 0xddddd, 2.2,

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

* [Bug c++/59716] variadic template multiple parameter pack expansion fails
  2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
                   ` (11 preceding siblings ...)
  2022-04-07 13:28 ` ppalka at gcc dot gnu.org
@ 2022-04-30 16:01 ` ppalka at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-04-30 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|10.4                        |12.0
         Resolution|---                         |DUPLICATE
            Summary|[10/11 Regression] variadic |variadic template multiple
                   |template multiple parameter |parameter pack expansion
                   |pack expansion fails        |fails
           See Also|https://gcc.gnu.org/bugzill |
                   |a/show_bug.cgi?id=88580     |

--- Comment #10 from Patrick Palka <ppalka at gcc dot gnu.org> ---
So I guess we should consider this a dup of the non-regression PR88580 which is
fixed for GCC 12.

*** This bug has been marked as a duplicate of bug 88580 ***

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

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-08  7:15 [Bug c++/59716] New: variadic template multiple parameter pack expansion fails lts-rudolph at gmx dot de
2015-04-04  9:27 ` [Bug c++/59716] " paolo.carlini at oracle dot com
2015-08-03 11:02 ` lts-rudolph at gmx dot de
2021-08-10  2:27 ` pinskia at gcc dot gnu.org
2021-08-10  2:56 ` pinskia at gcc dot gnu.org
2021-11-26 19:51 ` lts-rudolph at gmx dot de
2021-11-26 21:14 ` [Bug c++/59716] [10/11 Regression] " pinskia at gcc dot gnu.org
2021-12-09  9:24 ` marxin at gcc dot gnu.org
2021-12-09 14:38 ` pinskia at gcc dot gnu.org
2021-12-09 14:58 ` marxin at gcc dot gnu.org
2022-04-07  8:39 ` rguenth at gcc dot gnu.org
2022-04-07  9:29 ` rguenth at gcc dot gnu.org
2022-04-07 13:28 ` ppalka at gcc dot gnu.org
2022-04-30 16:01 ` [Bug c++/59716] " 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).