On 1/13/25 3:27 PM, Patrick Palka wrote:
Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK
for trunk?

OK, but do we also need this in the "still packed" case earlier in the function?

-- >8 --

During ahead of time template argument coercion, we handle the case of
passing a pack expansion to a non-pack parameter by breaking out early
and using the original unconverted arguments, deferring coercion until
instantiation time where we have concrete arguments.  We still however
need to strip typedefs from the original arguments as in the ordinary
case, for sake of our template argument hashing/equivalence routines
which assume template arguments went through strip_typedefs.

        PR c++/118454

gcc/cp/ChangeLog:

        * pt.cc (coerce_template_parms): Strip typedefs in the pack
        expansion arg vs non-pack parm early break special case.

gcc/testsuite/ChangeLog:

        * g++.dg/cpp0x/variadic187.C: New test.
---
  gcc/cp/pt.cc                             |  2 +-
  gcc/testsuite/g++.dg/cpp0x/variadic187.C | 13 +++++++++++++
  2 files changed, 14 insertions(+), 1 deletion(-)
  create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic187.C

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 537e4c4a494..8cdbf7f65ac 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -9362,7 +9362,7 @@ coerce_template_parms (tree parms,
                /* We don't know how many args we have yet, just
                 use the unconverted (but unpacked) ones for now.  */
              ggc_free (new_inner_args);
-              new_inner_args = inner_args;
+             new_inner_args = strip_typedefs (inner_args);
              arg_idx = nargs;
                break;
              }
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic187.C 
b/gcc/testsuite/g++.dg/cpp0x/variadic187.C
new file mode 100644
index 00000000000..af1770e4d89
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic187.C
@@ -0,0 +1,13 @@
+// PR c++/118454
+// { dg-do compile { target c++11 } }
+// { dg-additional-options --param=hash-table-verification-limit=1000 }
+
+template<class T> using identity = T;
+
+template<class T, class U0, class... Us> struct dual;
+
+template<class T, class... Ts>
+using ty1 = dual<identity<T>, Ts...>;
+
+template<class T, class... Ts>
+using ty2 = dual<T, Ts...>;

Reply via email to