]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: pack expansion arg vs non-pack parm checking ICE [PR118454]
authorPatrick Palka <ppalka@redhat.com>
Thu, 16 Jan 2025 21:08:25 +0000 (16:08 -0500)
committerPatrick Palka <ppalka@redhat.com>
Thu, 16 Jan 2025 21:08:25 +0000 (16:08 -0500)
commitd72e5b7be203f9bb9b7e2aac8dd812af7f70859f
treea9156a93d60ad5abe941e70c058b73d59c4b02b5
parent232d3a73e18d6886f0a5781048a78da293fbb014
c++: pack expansion arg vs non-pack parm checking ICE [PR118454]

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.

This PR illustrates we still need to strip typedefs from the original
arguments in this case as in the ordinary case, for sake of our template
argument hashing/equivalence routines which assume template arguments
went through strip_typedefs.

Since we're using the unconverted arguments we need to preserve
injected-class-name typedefs because we use them to distinguish passing
an injected-class-name vs the corresponding specialization as the
argument to a template template parameter (the former is valid, the
latter isn't).

PR c++/118454

gcc/cp/ChangeLog:

* cp-tree.h (STF_KEEP_INJ_CLASS_NAME): Define.
* pt.cc (iterative_hash_template_argument) <case tcc_type>:
Clarify comment for when we'd see an alias template
specialization here.
(coerce_template_parms): Strip typedefs (except for
injected-class-names) in the pack expansion early break cases
that defer coercion.
* tree.cc (strip_typedefs): Don't strip an injected-class-name
if STF_KEEP_INJ_CLASS_NAME is set.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/variadic187.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/cp-tree.h
gcc/cp/pt.cc
gcc/cp/tree.cc
gcc/testsuite/g++.dg/cpp0x/variadic187.C [new file with mode: 0644]