public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Dodji Seketeli <dodji@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR c++/53609 - Wrong argument deduction for pack expansion in argument pack
Date: Wed, 05 Dec 2012 16:01:00 -0000	[thread overview]
Message-ID: <50BF6FCC.90907@redhat.com> (raw)
In-Reply-To: <87vccjclke.fsf@redhat.com>

On 12/03/2012 08:27 AM, Dodji Seketeli wrote:
> +	- HAS_EXPANSION_ARG_P: Set to TRUE iff at least one parameter
> +	  pack has got an argument that is an expansion.

The "got" is unnecessary, just "has an argument" is better.

> +   Setup APS, which is an instance of an ARGUMENT_PACK_SELECT tree, so
> +   that it selects the Ith element out of the argument pack ARG_PACK.
> +   If the Ith element is a pack expansion, then just select its
> +   pattern.  Otherwise, select the whole element.

I wonder if, rather than set up a temporary pack at this point, it makes 
sense to look through pack expansions when we use an 
ARGUMENT_PACK_SELECT.  Is there any case where we actually want an 
ARGUMENT_PACK_SELECT to be an expansion?

> +  /* If we have one parameter pack whose matching argument pack is
> +     just what template_parm_to_arg returned when passed the
> +     parameter pack, or if we only have empty arguments ... */
> +  else if (arg_from_pack_level_to_prune || has_empty_arg)
> +    {
> +      /* ... we just return a pack expansion which pattern is PATTERN
> +	 into which ARGS has been substituted.  */
> +      *instantiation_yields_no_list_p = true;
> +    }

I was thinking we wouldn't need to recognize this case specifically, 
that the code following it would work the way we want.  If callers get a 
vector with a single pack expansion element rather than just a pack 
expansion, is that a problem?  Alternately, if len == 1, maybe we should 
always just return the single element.

> +  /* 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.  */
>    if (len < 0)
> -    return error_mark_node;
> +    len = 1;

Why this change?  Why is returning error_mark_node no longer the right 
thing to do?

Jason

  reply	other threads:[~2012-12-05 16:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-20  9:05 Dodji Seketeli
2012-11-16 13:16 ` [PING] " Dodji Seketeli
2012-11-16 22:39 ` Jason Merrill
2012-12-03 13:28   ` Dodji Seketeli
2012-12-05 16:01     ` Jason Merrill [this message]
2012-12-08 22:12       ` Dodji Seketeli
2012-12-10 22:38         ` Jason Merrill
2012-12-11 15:55           ` Dodji Seketeli
2012-12-11 16:40             ` Jason Merrill
2012-12-11 21:10               ` Dodji Seketeli
2012-12-11 21:26                 ` Jason Merrill
2012-12-12 13:28                   ` Dodji Seketeli
2012-12-17 19:03                     ` Jason Merrill
2012-12-19 18:21                       ` Dodji Seketeli
2013-01-19  1:49                         ` Jason Merrill
2013-01-21 20:09                           ` Dodji Seketeli
2013-01-21 20:44                             ` Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50BF6FCC.90907@redhat.com \
    --to=jason@redhat.com \
    --cc=dodji@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).