public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Adam Butcher <adam@jessamine.co.uk>
To: Jason Merrill <jason@redhat.com>
Cc: <gcc-patches@gcc.gnu.org>, Volker Reichelt <reichelt@gcc.gnu.org>
Subject: Re: [C++ PATCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.
Date: Sat, 09 Nov 2013 13:56:00 -0000	[thread overview]
Message-ID: <48a0350ad377d7ec6de413e61724fe4e@imap.force9.net> (raw)
In-Reply-To: <527D328D.9010800@redhat.com>

On 2013-11-08 18:50, Jason Merrill wrote:
> On 10/31/2013 05:47 AM, Adam Butcher wrote:
>> +         become_template = true;
>>
>> +         push_deferring_access_checks (dk_deferred);
>
> Why is this call here?  I don't see anything in the rest of the
> function that would trigger an access check, or a matching pop.
>
This is only in the 'fully implicit function template' case; and the 
matching pop is in finish_fully_implicit_template.  It was in the 
original impl which was trying to do all the things that beginning and 
ending an explicit template parameter list did.  Maybe this is 
unnecessary.  I'll see if anything breaks if I remove it.

>> +      /* Create a distinct parameter pack type from the current 
>> parm and add it
>> +        to the replacement args to tsubst below into the generic 
>> function
>> +        parameter.  */
>> +
>> +      tree t = copy_type (TREE_TYPE (TREE_VALUE (TREE_VEC_ELT 
>> (current, i))));
>> +      TYPE_STUB_DECL (t) = TYPE_NAME (t) = TEMPLATE_TYPE_DECL (t);
>
> Is this changing anything?  I'm not sure if we need to copy the decl
> or if we can just reuse it, but either way we need to set the type of
> TEMPLATE_TYPE_DECL (t) to t.
>
I think it (or at least one of the assignments) is necessary.  It is 
derived from some similar code in tsubst.  I'll have another look into 
it and add TREE_TYPE (TEMPLATE_TYPE_DECL (t)) = t also.  What problem 
will be caused by not setting the latter; is it a consistency issue?  I 
have not seen any probs in testing so far.

>> +      SET_TYPE_STRUCTURAL_EQUALITY (t);
>
> Why not
>
>       TYPE_CANONICAL (t) = canonical_type_parameter (t);
>
> ?
>
Only for the sake of not exposing this (currently static) function from 
pt.c (or moving the pack convert function into pt.c).  My original impl 
did extern canonical_type_parameter and use that and I think it worked 
as expected.  Would that be preferred?

Cheers,
Adam

  reply	other threads:[~2013-11-09 13:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-02 10:03 [SKETCH] " Adam Butcher
2013-11-02 10:03 ` [C++ PATCH 1/3] " Adam Butcher
2013-11-08 19:10   ` [C++ PATCH] " Jason Merrill
2013-11-09 13:56     ` Adam Butcher [this message]
2013-11-09 20:16       ` Adam Butcher
2013-11-10 10:34       ` Jason Merrill
2013-11-10 12:08         ` Adam Butcher
2013-11-10 16:14           ` Adam Butcher
2013-11-10 19:54             ` Jason Merrill
2013-11-10 20:28               ` Adam Butcher
2013-11-11  2:41                 ` Jason Merrill
2013-11-11 21:45                   ` Adam Butcher
2013-11-12  7:25                     ` Jason Merrill
2013-11-02 10:03 ` [C++ PATCH 3/3] Add some generic lambda test cases Adam Butcher
2013-11-02 10:03 ` [C++ PATCH 2/3] Support implicit parameter packs Adam Butcher

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=48a0350ad377d7ec6de413e61724fe4e@imap.force9.net \
    --to=adam@jessamine.co.uk \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=reichelt@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).