[PATCH] D19336: Repair redeclaration chain of friend template functions.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 13:57:12 PDT 2016


rsmith added a comment.

Sorry, I don't think this approach can work. Consider:

  template<typename T> struct X {
    template<typename U> friend void f(T);
    template<typename U> friend void f(U);
  };

These two friend declarations declare different friend function templates, but this transformation would incorrectly make them have the same type and be redeclarations of each other.

I think the right thing here is to just accept that a friend function template declared within a class template will not be part of the corresponding redeclaration chain. But that's fine, so long as we don't try to inject the function template into the surrounding scope -- when we come to instantiate the class template, the instantiated friend function template will have the right type and will be part of the relevant redeclaration chain.


http://reviews.llvm.org/D19336





More information about the cfe-commits mailing list