A question related to bug 5866.

Hello.

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

   http://llvm.org/bugs/show_bug.cgi?id=5866

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

     friend streamsize
     __copy_streambufs_eof<>(__streambuf_type*,
                             __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?

Regards,
Enea.

It sounds like a bug.

John.

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
  FunctionDecl::isFunctionTemplateSpecialization()
is allowed to return false and method
  FunctionDecl::getTemplateSpecializationKind()
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.

John.