[clang] 2d81994 - [NFC] Add test from issue 61125

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue May 6 23:47:43 PDT 2025


Author: Chuanqi Xu
Date: 2025-05-07T14:47:24+08:00
New Revision: 2d81994c4a41b950eed9bdee189cba9d00381b58

URL: https://github.com/llvm/llvm-project/commit/2d81994c4a41b950eed9bdee189cba9d00381b58
DIFF: https://github.com/llvm/llvm-project/commit/2d81994c4a41b950eed9bdee189cba9d00381b58.diff

LOG: [NFC] Add test from issue 61125

Added: 
    clang/test/Modules/befriend.cppm

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/Modules/befriend.cppm b/clang/test/Modules/befriend.cppm
new file mode 100644
index 0000000000000..3a251f1f49aee
--- /dev/null
+++ b/clang/test/Modules/befriend.cppm
@@ -0,0 +1,41 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
+// RUN: %clang_cc1 -std=c++20 %t/b.cpp -fmodule-file=a=%t/a.pcm -emit-llvm -o /dev/null -verify
+
+//--- a.cppm
+module;
+
+namespace n
+{
+
+template<typename>
+struct a {
+	template<typename T>
+	friend void aa(a<T>);
+};
+
+template<typename T>
+inline void aa(a<T>) {
+}
+
+} //namespace n
+
+export module a;
+
+namespace n {
+
+export using n::a;
+export using n::aa;
+
+}
+
+//--- b.cpp
+// expected-no-diagnostics
+import a;
+
+void b() {
+	aa(n::a<int>());
+}


        


More information about the cfe-commits mailing list