[clang] [clang] fix crash in friend definition (PR #186398)

via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 15 13:59:49 PDT 2026


================
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s
+
+
+template<class>
+struct D;
+
+template<class T>
+void foo(D<T>);
+
+template<class T>
+struct D {
+  friend void ::foo(D) {} // expected-error {{friend function definition cannot be qualified with '::'}}
+};
+
+int main() {
+  foo(D<int>{});
+}
----------------
Serosh-commits wrote:

yeah i will be careful and make sure from now will include a trailing new line np!

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


More information about the cfe-commits mailing list