On 09/05/2012 02:17 PM, Paolo Carlini wrote:
In fact, something seems weird earlier, in
cp_parser_check_template_parameters. It has:
/* If there are the same number of template classes and parameter
lists, that's OK. */
if (parser->num_template_parameter_lists == num_templates)
return true;
/* If there are more, but only one more, then we are referring to a
member template. That's OK too. */
if (parser->num_template_parameter_lists == num_templates + 1)
return true;
Right.
but note that for:
template <class T>
struct A
{
int select() { return 0; }
};
we have parser->num_template_parameter_lists == 1 and num_templates ==
0. Thus it seems that the case 'num_templates + 1' isn't (just) about
member templates...
That's odd, num_templates should be 1. And I notice that
cp_parser_check_declarator_template_parameters has another copy of the
num_template_headers_for_class logic; they should be merged.
I think the problem with 24314 is that we try to decide how many
template headers we want before we determine what declaration we're
looking at. When we have a redefinition or specialization, we know
exactly how many headers we want, and we should check accordingly rather
than say N or N+1.
Jason