Re: [PATCH] PRs c++/51239, c++/51180 - Better support for unbound alias template specialization

2011-12-06 Thread Jason Merrill

On 12/05/2011 07:15 PM, Gabriel Dos Reis wrote:

you need to spend more time in Paris :-)


Clearly! :)

Jason



Re: [PATCH] PRs c++/51239, c++/51180 - Better support for unbound alias template specialization

2011-12-05 Thread Jason Merrill
Hmm.  I know I'm the one that suggested this approach, but I think I'm 
uncomfortable with this minimal change, since code for handling 
BOUND_TEMPLATE_TEMPLATE_PARM expects to be able to get a 
TEMPLATE_TYPE_PARM_INDEX out of it, and that won't work for the alias 
template use.


So I'd like to rename BOUND_TEMPLATE_TEMPLATE_PARM to something more 
generic, perhaps TEMPLATE_ID_TYPE, that just takes a template and args. 
 So existing uses of BOUND_TEMPLATE_TEMPLATE_PARM would be replaced 
with a TEMPLATE_ID_TYPE around a TEMPLATE_TEMPLATE_PARM.


At that point it probably makes sense to replace the use of 
TEMPLATE_ID_EXPR in TYPENAME_TYPE with TEMPLATE_ID_TYPE.


Does this make sense?  Sorry to make more work for you.

Also, rather than pass back unknown_nb_args_p from 
coerce_template_parms, let's make it a predicate next to 
any_dependent_template_arguments_p and then use it in both places.  And 
change the name; it took me a little while to realize that nb is short 
for number.


Thanks,
Jason



Re: [PATCH] PRs c++/51239, c++/51180 - Better support for unbound alias template specialization

2011-12-05 Thread Dodji Seketeli
Jason Merrill ja...@redhat.com writes:

 Hmm.  I know I'm the one that suggested this approach, but I think I'm
 uncomfortable with this minimal change, since code for handling
 BOUND_TEMPLATE_TEMPLATE_PARM expects to be able to get a
 TEMPLATE_TYPE_PARM_INDEX out of it, and that won't work for the alias
 template use.

Yes.  Though I thought I'd spot those places if need be (as I was hoping
the code to ICE for these cases) and let them try to access the
TEMPLATE_TYPE_PARM_INDEX only for non-alias template use cases.  Not
elegant, granted.

 So I'd like to rename BOUND_TEMPLATE_TEMPLATE_PARM to something more
 generic, perhaps TEMPLATE_ID_TYPE, that just takes a template and
 args. So existing uses of BOUND_TEMPLATE_TEMPLATE_PARM would be
 replaced with a TEMPLATE_ID_TYPE around a TEMPLATE_TEMPLATE_PARM.

 At that point it probably makes sense to replace the use of
 TEMPLATE_ID_EXPR in TYPENAME_TYPE with TEMPLATE_ID_TYPE.

 Does this make sense?

Yes it does.

  Sorry to make more work for you.

No problem.  I wasn't sure I'd be able to sell the amount of change
incurred by this kind of generic approach in the first place.  It's
great that I don't have to.  ;-)

 Also, rather than pass back unknown_nb_args_p from
 coerce_template_parms, let's make it a predicate next to
 any_dependent_template_arguments_p and then use it in both places.
 And change the name; it took me a little while to realize that nb is
 short for number.

Okay.  I'll look into this.

Thanks.

-- 
Dodji


Re: [PATCH] PRs c++/51239, c++/51180 - Better support for unbound alias template specialization

2011-12-05 Thread Gabriel Dos Reis
On Mon, Dec 5, 2011 at 9:01 AM, Jason Merrill ja...@redhat.com wrote:
 it took me a little while to realize that nb is short for number.

you need to spend more time in Paris :-)

-- Gaby


Re: [PATCH] PRs c++/51239, c++/51180 - Better support for unbound alias template specialization

2011-12-02 Thread Gabriel Dos Reis
On Fri, Dec 2, 2011 at 9:51 AM, Dodji Seketeli do...@redhat.com wrote:

 After talking with you offline, we settled on using the existing
 BOUND_TEMPLATE_TEMPLATE_PARM tree to represent this new construct.
 The alias template and its unbound arguments are stored in the
 TYPE_TEMPLATE_INFO of the tree and its TYPE_NAME has the
 TYPE_DECL_ALIAS_P flag set.

This representation sounds much more regular to me, considering
the existing patterns of representing templates.  The alias part in
template alias just means that we can substitute right away when
the alias is applied.  Otherwise, it is a template (like any other) in
all other aspects (except it can't be deduced.)

-- Gaby