On 09/06/2012 12:18 PM, Paolo Carlini wrote:
On 09/06/2012 02:03 AM, Jason Merrill wrote:
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.
Yes, it seems odd, the same happens for template functions, like simply:

template <class T>
void foo();

That seems right; there is one more set of template parameters than required for the scope, so foo itself is a primary template. If above you were talking about when we're looking at "struct A" it is right, too.

Really, whatever we do at least the comment should be adjusted not to
mention only member templates.

Yes, it's any case of declaring a primary template.

Something like the attached passes testing, the clean-up is nice, but
I'm not sure about the specific details of the existing code vs
num_template_headers_for_class, whether we can just call the latter as I
did and be done.

I think I prefer the code from here and would change num_template_headers_for_class to match.

I see. Yesterday at some point I wondered whether we could do that
already when cp_parser_check_template_parameters is called, that is
remove the + 1 case and make the callers more precise. But I understand
not that it's too early. Then, are you under the impression that we
should still have cp_parser_check_template_parameters as-is and add a
check later, or have only the late one?

I think it ought to work to only have a late check.

Jason


Reply via email to