[clang] [Clang][Sema] Diagnose friend function specialization definitions (PR #72863)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 27 02:58:24 PST 2023


================
@@ -373,6 +373,7 @@ template <class T> void foo() {} // expected-note{{candidate ignored: not a memb
 }
 using ns::foo;
 template <class T> struct A {
+  // expected-error at +1{{friend function specialization cannot be defined}}
----------------
sdkrystian wrote:

Per my other comment, I think the right thing to do here is to diagnose friend function definitions after calling `ActOnFunctionDecl`... in this case we would emit the "no candidate function template was found for dependent friend function template specialization" diagnostic, but not "friend function specialization cannot be defined".

https://github.com/llvm/llvm-project/pull/72863


More information about the cfe-commits mailing list