From: Jason Merrill <jason@redhat.com>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>,
Nathan Sidwell <nathan@acm.org>
Subject: Re: [PATCH] [PR87012] canonicalize ref type for tmpl arg
Date: Fri, 14 Dec 2018 14:31:00 -0000 [thread overview]
Message-ID: <CADzB+2n+TJbbf3VYisbg=CtJstoHfQ7gSBELErzWYXPMV4hgzA@mail.gmail.com> (raw)
In-Reply-To: <orr2ekevmw.fsf@lxoliva.fsfla.org>
On Thu, Dec 13, 2018 at 8:37 PM Alexandre Oliva <aoliva@redhat.com> wrote:
> On Dec 5, 2018, Jason Merrill <jason@redhat.com> wrote:
>
> > I would expect that this same issue would come up with other types; I
> > think we want to fix this sooner, when we are figuring out what type
> > we want to convert the argument to.
>
> You mean like this?
>
> [PR87012] canonicalize ref type for tmpl arg
>
> When binding an object to a template parameter of reference type, we
> take the address of the object and dereference that address. The type
> of the address may still carry (template) typedefs, but
> verify_unstripped_args_1 rejects such typedefs other than in the top
> level of template arguments.
>
> Canonicalizing the type we want to convert to right after any
> substitutions or deductions avoids that issue.
>
> Regstrapped on x86_64- and i686-linux-gnu. Ok to install?
>
>
> for gcc/cp/ChangeLog
>
> PR c++/87012
> * pt.c (convert_template_argument): Canonicalize type after
> tsubst/deduce.
>
> for gcc/testsuite/ChangeLog
>
> PR c++/87012
> * g++.dg/cpp0x/pr87012.C: New.
> ---
> gcc/cp/pt.c | 2 ++
> gcc/testsuite/g++.dg/cpp0x/pr87012.C | 11 +++++++++++
> 2 files changed, 13 insertions(+)
> create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr87012.C
>
> diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
> index 72ae7173d92c..0d388c67459a 100644
> --- a/gcc/cp/pt.c
> +++ b/gcc/cp/pt.c
> @@ -8018,6 +8018,8 @@ convert_template_argument (tree parm,
> if (invalid_nontype_parm_type_p (t, complain))
> return error_mark_node;
>
> + t = canonicalize_type_argument (t, complain);
Yes, like that, thanks. It might be a bit of an optimization to skip
this when t == TREE_TYPE (parm). OK either way.
Jason
next prev parent reply other threads:[~2018-12-14 14:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 22:33 Alexandre Oliva
2018-12-06 1:25 ` Jason Merrill
2018-12-14 2:34 ` Alexandre Oliva
2018-12-14 14:31 ` Jason Merrill [this message]
2018-12-19 8:03 ` Alexandre Oliva
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='CADzB+2n+TJbbf3VYisbg=CtJstoHfQ7gSBELErzWYXPMV4hgzA@mail.gmail.com' \
--to=jason@redhat.com \
--cc=aoliva@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nathan@acm.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).