A question related to bug 5866.


I was struggling against friend declarations of template function specializations, i.e., something strongly related to the following (resolved) bug:


The problem we have is the following: when visiting a friend declaration such as the one used in the bug report above

     friend streamsize
                             __streambuf_type*, bool&);

we call method getFriendDecl() and obtain a FunctionDecl*,
but when querying this pointer using method
     bool FunctionDecl::isFunctionTemplateSpecialization()
the answer turns out to be negative.

Is this a bug, or are we just calling the method above out of its specification? Are there other ways to check if a friend declaration is referring to a template function specialization?


It sounds like a bug.


John McCall wrote:

If I understand the ratio from clang documentation, since these are dependent, they are not actual function template specializations/instances, hence method
is allowed to return false and method
returns TSK_Undeclared.

Ah, yes, if either the template arguments or the function itself are dependent then we won't resolve it to a specialization, that is true.

It would be nicer if a more uniform naming scheme and a common iteration pattern were available.

I've remarked this myself; it's really just a historical accident that things have fallen out this way. That would be a very reasonable refactor.