On Jan 27, 2019, Jason Merrill <ja...@redhat.com> wrote: >> + tinfo = DECL_TEMPLATE_INFO (node);
> Maybe use get_template_info? Neat! But then, if we can assume node is a decl, we might as well go straight for DECL_TEMPLATE_INFO. I'd rather not make that assumption, though, and allow this new function to be called for template types as well, because you mentioned other places that used PRIMARY_TEMPLATE_P might need the extra logic. I don't know whether they might be dealing with types though. >> + ??? How do we >> + tell apart a partial from a full explicit specialization in a >> + non-template context? */ > We don't need to tell them apart here, the caller checks if there are > any dependent template arguments. The single caller does, indeed, but the function does not make that a requirement, so others might call it and fail to check it. Should that test be moved here too? Anyhow, the question was really about the fact that the non-template context has no template argument depth for us to compare with. When I wrote that comment, I was returning true for !ctinfo, unconditionally, reasoning that if NODE's context is not a template, then NODE must specialize some a primary template. But if we want partial but not full explicit specializations, then just having a deeper (or nonzero) template argument depth is not enough, is it? >> + tree ctxt; >> + if (!DECL_P (node)) >> + ctxt = TYPE_CONTEXT (node); >> + else >> + ctxt = DECL_CONTEXT (node); > We know tmpl is a decl, so we can unconditionally take its DECL_CONTEXT. Does it hurt too much to keep it more general, so that it can deal with template class types too? Or is there going to be no use for that? In the latter case, I suppose we should document that, and then we just use tinfo = DECL_TEMPLATE_INFO (node) above (right?) > And you can use get_template_info here as well. *nod*, thanks -- Alexandre Oliva, freedom fighter https://FSFLA.org/blogs/lxo Be the change, be Free! FSF Latin America board member GNU Toolchain Engineer Free Software Evangelist Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe