This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR c++/53609 - Wrong argument deduction for pack expansion in argument pack
- From: Jason Merrill <jason at redhat dot com>
- To: Dodji Seketeli <dodji at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 18 Jan 2013 20:49:40 -0500
- Subject: Re: [PATCH] PR c++/53609 - Wrong argument deduction for pack expansion in argument pack
- References: <m3haqtozhj.fsf@redhat.com> <50A6C0B0.8070407@redhat.com> <87vccjclke.fsf@redhat.com> <50BF6FCC.90907@redhat.com> <87ip8cb3d1.fsf@redhat.com> <50C66442.9010903@redhat.com> <87hansa8hz.fsf@redhat.com> <50C76202.8040909@redhat.com> <87txrs8fdu.fsf@redhat.com> <50C7A511.5080803@redhat.com> <87k3sn8lvl.fsf@redhat.com> <50CF6C5B.5070107@redhat.com> <87lict52e5.fsf@redhat.com>
Sorry it's taken so long for me to respond to this; I forgot about it
over the holiday break. The patch is in good shape now, just a few
tweaks left:
On 12/19/2012 01:21 PM, Dodji Seketeli wrote:
+ tree aps; /* instance of ARGUMENT_PACK_SELECT
+ tree. */
Odd comment formatting.
+ /* We could not find any argument packs that work, so we'll just
+ return an unsubstituted pack expansion. The caller must be
+ prepared to deal with this. */
I still find this comment confusing. I think it would be more correct
to say "we'll just return a substituted pack expansion".
Also, it seems like the unsubstituted_packs code does what we want, so
you could use that directly rather than change len.
+ if (unsubstituted_packs || use_pack_expansion_extra)
{
- if (real_packs)
+ if (use_pack_expansion_extra)
It seems like the outer "if" is redundant here.
+ /* If the Ith argument pack element is a pack expansion, then
+ the Ith element resulting from the substituting is going to
+ be a pack expansion as well. */
+ if (has_bare_parameter_packs (t))
+ t = make_pack_expansion (t);
Instead of walking through 't' here, I think it would be cheaper to
remember if the pack element was a pack expansion. In which case maybe
we don't need to split out has_bare_parameter_packs.
+ if (len > 0)
{
+ for (i = 0; i < len; ++i)
{
The "if" seems redundant here, too.
Jason