[PATCH] D21767: Fix instantiation of friend function templates

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 14 10:31:54 PDT 2018


sepavloff added a comment.

In https://reviews.llvm.org/D21767#1197783, @rjmccall wrote:

> Shouldn't there just be a link in the AST from the instantiated `FunctionTemplateDecl ` back to the original pattern?  Maybe a generalization of `InstantiatedFromMember` in `RedeclarablableTemplateDecl`?


The field `InstantiatedFromMember` indeed helps finding function template definition, this patch only modifies search algorithm to make it suitable for friend templates. Friend function templates have dual nature, they may be members of redeclaration chains, like usual namespace level function templates and still use `InstantiatedFromMember` like member function templates. So the resulting search algorithm (implemented in `getPatternFor`) scans both redeclaration chain and the chain formed by `InstantiatedFromMember`.


Repository:
  rC Clang

https://reviews.llvm.org/D21767





More information about the cfe-commits mailing list