[NFC] [C++20] [Modules] Add test to show private module fragment is not allowed in...
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Wed, 9 Mar 2022 11:05:41 +0000 (19:05 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Wed, 9 Mar 2022 11:05:54 +0000 (19:05 +0800)
clang/test/CXX/module/module.private.frag/p1.cpp [new file with mode: 0644]

diff --git a/clang/test/CXX/module/module.private.frag/p1.cpp b/clang/test/CXX/module/module.private.frag/p1.cpp
new file mode 100644 (file)
index 0000000..af3d52f
--- /dev/null
@@ -0,0 +1,25 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/parta.cppm -o %t/mod-parta.pcm -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/impl.cppm -o %t/mod-impl.pcm -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/primary.cppm -o %t/mod.pcm -fsyntax-only -verify
+
+//--- parta.cppm
+export module mod:parta;
+
+module :private; // expected-error {{private module fragment declaration with no preceding module declaration}}
+
+//--- impl.cppm
+
+module mod:impl;
+
+module :private; // expected-error {{private module fragment declaration with no preceding module declaration}}
+
+//--- primary.cppm
+//expected-no-diagnostics
+export module mod;
+
+module :private;
+