[PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 13:44:08 PDT 2016


rsmith added a comment.

Please also add some testcases for the corresponding case for a friend function template:

  template<typename T> void f();
  template<typename> struct A {
    template<typename T> void f() {}
  };
  template<typename> struct B {
    template<typename T> void f() {}
  };
  A<int> a;
  B<int> b; // ill-formed


================
Comment at: test/SemaCXX/PR25848.cpp:4
@@ +3,3 @@
+struct A;
+typedef int A::* P;
+
----------------
Maybe use `int` instead of a pointer to member type here? May as well keep the parts that aren't relevant to the test as simple as possible.

================
Comment at: test/SemaCXX/friend2.cpp:77
@@ +76,3 @@
+// Even if clases are not instantiated and hence friend functions defined in them are not
+// available, their declarations must be checked.
+
----------------
"must be" -> "can be" (or maybe "should be")

We're not required to diagnose this; it's a QoI issue.


http://reviews.llvm.org/D16989





More information about the cfe-commits mailing list