[clang] 37b7a60 - [NFC] Add a test for C++20 Modules
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 16 01:14:57 PST 2023
Author: Chuanqi Xu
Date: 2023-02-16T17:14:16+08:00
New Revision: 37b7a60cd74b7a1754583b7eb63a6339158fd398
URL: https://github.com/llvm/llvm-project/commit/37b7a60cd74b7a1754583b7eb63a6339158fd398
DIFF: https://github.com/llvm/llvm-project/commit/37b7a60cd74b7a1754583b7eb63a6339158fd398.diff
LOG: [NFC] Add a test for C++20 Modules
Add a test to check that the template instantiation during the template
specialization wouldn't be emitted again in the importer.
Added:
Modified:
clang/test/Modules/pr60693.cppm
Removed:
################################################################################
diff --git a/clang/test/Modules/pr60693.cppm b/clang/test/Modules/pr60693.cppm
index 117a0f2753d0..c50791083a5b 100644
--- a/clang/test/Modules/pr60693.cppm
+++ b/clang/test/Modules/pr60693.cppm
@@ -16,7 +16,14 @@ constexpr bool f() {
return true;
}
-export template<typename>
+template <typename T>
+struct u {
+ T unit() {
+ return T();
+ }
+};
+
+export template<typename T>
struct s {
static constexpr auto a = f();
static constexpr auto b = f();
@@ -28,6 +35,9 @@ struct s {
int bar() {
return 44;
}
+ T zoo() {
+ return u<T>().unit();
+ }
};
template struct s<int>;
@@ -46,9 +56,15 @@ extern "C" long use2() {
return _.foo();
}
+extern "C" long use3() {
+ s<long> _;
+ return _.zoo();
+}
+
// CHECK: define{{.*}}@use(
// CHECK-NOT: }
// CHECK: ret{{.*}} 4
// CHECK: declare{{.*}}@_ZNW1a1sIlE3fooEv
// CHECK-NOT: _ZNW1a1sIlE3barEv
+// CHECK: declare{{.*}}_ZNW1a1sIlE3zooEv
More information about the cfe-commits
mailing list