[clang] ae4eb93 - [NFC] [C++20] [Modules] Add test to show private module fragment is not allowed in partition unit

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 9 03:06:12 PST 2022


Author: Chuanqi Xu
Date: 2022-03-09T19:05:54+08:00
New Revision: ae4eb938c00785540a8c395c9d166cff7516f280

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

LOG: [NFC] [C++20] [Modules] Add test to show private module fragment is not allowed in partition unit

Added: 
    clang/test/CXX/module/module.private.frag/p1.cpp

Modified: 
    

Removed: 
    


################################################################################
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
index 0000000000000..af3d52f3bd325
--- /dev/null
+++ b/clang/test/CXX/module/module.private.frag/p1.cpp
@@ -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;
+


        


More information about the cfe-commits mailing list