From: Patrick Palka <ppalka@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: Patrick Palka <ppalka@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++: constness of decltype of NTTP object [PR98820]
Date: Sat, 16 Sep 2023 18:00:04 -0400 (EDT) [thread overview]
Message-ID: <2c31b908-2d65-e879-1093-90a3cd1a6e11@idea> (raw)
In-Reply-To: <8348062b-aeaa-56e4-71d5-c447b5b4d766@redhat.com>
On Sat, 16 Sep 2023, Jason Merrill wrote:
> On 9/15/23 13:55, Patrick Palka wrote:
> > This corrects decltype of a (class) NTTP object as per
> > [dcl.type.decltype]/1.2 and [temp.param]/6 in the type-dependent case.
> > In the non-dependent case (nontype-class8.C) we resolve the decltype
> > ahead of time, and finish_decltype_type already made sure to drop the
> > const VIEW_CONVERT_EXPR wrapper around the TEMPLATE_PARM_INDEX.
>
> Hmm, seems like dropping the VIEW_CONVERT_EXPR is wrong in this case? I'm not
> sure why I added that.
Ah sorry, my commit message was a bit sloppy.
In the non-dependent case we resolve the decltype ahead of time, in
which case finish_decltype_type drops the const VIEW_CONVERT_EXPR
wrapper around the TEMPLATE_PARM_INDEX, and the latter has the
desired non-const type.
In the type-dependent case, tsubst drops the VIEW_CONVERT_EXPR
because the substituted class NTTP is the already const object
created by get_template_parm_object. So finish_decltype_type
at instantiation time sees the bare const object, which this patch
now adds special handling for.
So we need to continue dropping the VIEW_CONVERT_EXPR to handle the
non-dependent case.
>
> Jason
>
>
next prev parent reply other threads:[~2023-09-16 22:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 17:55 Patrick Palka
2023-09-16 20:26 ` Jason Merrill
2023-09-16 22:00 ` Patrick Palka [this message]
2023-09-18 2:46 ` 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=2c31b908-2d65-e879-1093-90a3cd1a6e11@idea \
--to=ppalka@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@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).