[clang] e76e3a0 - [NFC] Add a test about template pack for C++20 Modules
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 27 22:39:02 PST 2023
Author: Chuanqi Xu
Date: 2023-02-28T14:38:46+08:00
New Revision: e76e3a091961ee4e5b01825527832f05234011d6
URL: https://github.com/llvm/llvm-project/commit/e76e3a091961ee4e5b01825527832f05234011d6
DIFF: https://github.com/llvm/llvm-project/commit/e76e3a091961ee4e5b01825527832f05234011d6.diff
LOG: [NFC] Add a test about template pack for C++20 Modules
I found the issue in a donwstream project. But the case looks fine in
the upstream. Add the test to make sure that it wouldn't happen in the
upstream.
Added:
clang/test/Modules/template-pack.cppm
Modified:
Removed:
################################################################################
diff --git a/clang/test/Modules/template-pack.cppm b/clang/test/Modules/template-pack.cppm
new file mode 100644
index 0000000000000..eca17f31f015e
--- /dev/null
+++ b/clang/test/Modules/template-pack.cppm
@@ -0,0 +1,51 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cppm -o %t/a.pcm
+// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fprebuilt-module-path=%t -fsyntax-only -verify
+
+//--- foo.h
+
+namespace std
+{
+ template<class _Dom1>
+ void operator &&(_Dom1 __v, _Dom1 __w)
+ {
+ return;
+ }
+}
+
+//--- bar.h
+namespace std
+{
+ template<typename... _Types>
+ struct _Traits
+ {
+ static constexpr bool _S_copy_ctor =
+ (__is_trivial(_Types) && ...);
+ };
+
+ template<typename... _Types>
+ struct variant
+ {
+ void
+ swap(variant& __rhs)
+ noexcept((__is_trivial(_Types) && ...))
+ {
+ }
+ };
+}
+
+//--- a.cppm
+module;
+#include "foo.h"
+#include "bar.h"
+export module a;
+
+//--- b.cppm
+// expected-no-diagnostics
+module;
+#include "bar.h"
+export module b;
+import a;
More information about the cfe-commits
mailing list