[clang] bb3b830 - [NFC] [C++20] [Modules] Add a test module local declaration lookup
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 11 19:50:01 PDT 2025
Author: Chuanqi Xu
Date: 2025-06-12T10:48:34+08:00
New Revision: bb3b8306dc226c4dc4dfde36444b43476eea66ee
URL: https://github.com/llvm/llvm-project/commit/bb3b8306dc226c4dc4dfde36444b43476eea66ee
DIFF: https://github.com/llvm/llvm-project/commit/bb3b8306dc226c4dc4dfde36444b43476eea66ee.diff
LOG: [NFC] [C++20] [Modules] Add a test module local declaration lookup
From
https://github.com/llvm/llvm-project/issues/143734, but it looks good on
trunk. Add it as tests are always good.
Added:
clang/test/Modules/module-local-declarations.cppm
Modified:
Removed:
################################################################################
diff --git a/clang/test/Modules/module-local-declarations.cppm b/clang/test/Modules/module-local-declarations.cppm
new file mode 100644
index 0000000000000..4fbcf09e4d792
--- /dev/null
+++ b/clang/test/Modules/module-local-declarations.cppm
@@ -0,0 +1,30 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 %t/Base.cppm -emit-module-interface -o %t/Base.pcm
+// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm -fprebuilt-module-path=%t
+// RUN: %clang_cc1 -std=c++20 %t/B.cppm -fsyntax-only -verify -fprebuilt-module-path=%t
+
+//--- Base.cppm
+export module Base;
+export template <class T>
+class Base {};
+
+//--- A.cppm
+export module A;
+import Base;
+struct S {};
+
+export Base<S> a;
+
+//--- B.cppm
+// expected-no-diagnostics
+export module B;
+
+import A;
+import Base;
+
+struct S {};
+
+export Base<S> b;
More information about the cfe-commits
mailing list