File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ // REQUIRES: system-windows
2
+
3
+ // RUN: rm -rf %t
4
+ // RUN: mkdir -p %t
5
+ // RUN: split-file %s %t
6
+
7
+ // RUN: %clang_cl /std:c++20 --precompile "%/t/Hello.cppm" "/Fo%/t/Hello.pcm"
8
+ // RUN: %clang_cl /std:c++20 %/t/use.cpp -fmodule-file=Hello=%/t/Hello.pcm %/t/Hello.pcm /Fo%/t/SimpleHelloWorld.exe 2>&1
9
+
10
+ // RUN: %/t/SimpleHelloWorld.exe
11
+ // CHECK: Simple Hello World!
12
+
13
+ // --- Hello.cppm
14
+ module ;
15
+ #include < iostream>
16
+ export module Hello;
17
+ export void hello () {
18
+ std::cout << " Simple Hello World!\n " ;
19
+ }
20
+
21
+ // --- use.cpp
22
+ import Hello;
23
+ int main () {
24
+ hello ();
25
+ return 0 ;
26
+ }
27
+
28
+ // --- M.cppm
29
+ export module M;
30
+ export import :interface_part;
31
+ import :impl_part;
32
+ export void Hello ();
33
+
34
+ // --- interface_part.cpp
35
+ export module M:interface_part;
36
+ export void World ();
37
+
38
+ // --- impl_part.cppm
39
+ module ;
40
+ #include < iostream>
41
+ #include < string>
42
+ module M:impl_part;
43
+ import :interface_part;
44
+
45
+ std::string W = " World!" ;
46
+ void World () {
47
+ std::cout << W << std::endl;
48
+ }
49
+
50
+ // --- Impl.cpp
51
+ module ;
52
+ #include < iostream>
53
+ module M;
54
+ void Hello () {
55
+ std::cout << " Complex Hello " ;
56
+ }
57
+
58
+ // --- User.cpp
59
+ import M;
60
+ int main () {
61
+ Hello ();
62
+ World ();
63
+ return 0 ;
64
+ }
65
+
You can’t perform that action at this time.
0 commit comments