public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Patrick Palka <ppalka@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++: ahead of time variable template-id coercion [PR89442]
Date: Wed, 28 Jun 2023 11:28:41 -0400	[thread overview]
Message-ID: <7056eded-6519-ed60-9edc-17793b0dcbb1@redhat.com> (raw)
In-Reply-To: <20230503135043.273442-1-ppalka@redhat.com>

On 5/3/23 09:50, Patrick Palka wrote:
> This patch makes us coerce the arguments of a variable template-id ahead
> of time, as we do for other template-ids, which allows us to immediately
> diagnose template parameter/argument kind mismatches and arity mismatches.
> 
> Unfortunately this causes a regression in cpp1z/constexpr-if20.C: coercing
> the variable template-id m<ar, as> ahead of time means we strip it of
> typedefs, yielding m<typename C<i>::q, typename C<j>::q>, but in this
> stripped form we're directly using 'i' and so we expect to have captured
> it.  This is PR107437 but with a variable template instead of a class
> template.  I'm not sure how to fix this :(

Hmm, it does seem like strip_typedefs needs to be more conservative in a 
lambda.  We can probably stop stripping dependent function-scope 
typedefs in general without breaking things like cpp0x/decltype62.C.

> @@ -22097,7 +22099,7 @@ instantiate_template (tree tmpl, tree orig_args, tsubst_flags_t complain)
>         /* We need to determine if we're using a partial or explicit
>   	 specialization now, because the type of the variable could be
>   	 different.  */
> -      tree tid = lookup_template_variable (tmpl, targ_ptr);
> +      tree tid = build2 (TEMPLATE_ID_EXPR, NULL_TREE, tmpl, targ_ptr);

Why?  I'd think we want to consider partial specializations based on the 
coerced arguments.

Jason


  parent reply	other threads:[~2023-06-28 15:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03 13:50 Patrick Palka
2023-05-03 14:11 ` Patrick Palka
2023-06-01 15:42 ` Patrick Palka
2023-06-28 15:28 ` Jason Merrill [this message]
2023-06-28 15:48   ` 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=7056eded-6519-ed60-9edc-17793b0dcbb1@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ppalka@redhat.com \
    /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).