On 02/21/2014 03:19 AM, Adam Butcher wrote:
A class template with an out-of-line generic function definition will
give the same issue I think:
template <typename T>
void A<T>::f(auto x) {} // should inject a new list
Right. template_class_depth should be useful here. This is basically
the same question as whether a particular member function is a primary
template (member template) or not, but figuring it out in the middle of
the parameter list complicates things.
Once it's resolved I think it'd be useful to create a new function to
determine this rather than doing the scope walk in a number of places.
Something like 'templ_parm_scope_for_fn_being_declared' --- or hopefully
some more elegant name!
Right.
Why doesn't num_template_parameter_lists work as a predicate here?
It works in the lambda case as it is updated there, but for generic
functions I think the following prevents it:
cp/parser.c:17063:
/* Inside the function parameter list, surrounding
template-parameter-lists do not apply. */
saved_num_template_parameter_lists
= parser->num_template_parameter_lists;
parser->num_template_parameter_lists = 0;
Hmm, I wonder what that's for? What breaks when you remove it? :)
Jason