[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Modules / cxx20-10-2-ex2.cpp
blobbc66d6a2ec1a92e2bf13c2b003e058fbf608eed9
1 // Based on C++20 10.2 example 2.
3 // RUN: rm -rf %t
4 // RUN: mkdir -p %t
5 // RUN: split-file %s %t
7 // RUN: %clang_cc1 -std=c++20 -emit-header-unit -I %t \
8 // RUN: -xc++-user-header std-10-2-ex2-c.h -o %t/std-10-2-ex2-c.pcm
10 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std-10-2-ex2-tu1.cpp \
11 // RUN: -o %t/X.pcm
13 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std-10-2-ex2-tu2.cpp \
14 // RUN: -fmodule-file=%t/std-10-2-ex2-c.pcm -fmodule-file=X=%t/X.pcm \
15 // RUN: -pedantic-errors -verify -o %t/M.pcm
17 //--- std-10-2-ex2-b.h
18 int f();
20 //--- std-10-2-ex2-c.h
21 int g();
23 //--- std-10-2-ex2-tu1.cpp
24 export module X;
25 export int h();
27 //--- std-10-2-ex2-tu2.cpp
28 module;
29 #include "std-10-2-ex2-b.h"
31 export module M;
32 import "std-10-2-ex2-c.h"; // expected-warning {{the implementation of header units is in an experimental phase}}
33 import X;
34 export using ::f, ::g, ::h; // OK
35 struct S; // expected-note {{target of using declaration}}
36 export using ::S; // expected-error {{using declaration referring to 'S' with module linkage cannot be exported}}
38 namespace N {
39 export int h();
40 static int h(int); // expected-note {{target of using declaration}}
41 } // namespace N
42 export using N::h; // expected-error {{using declaration referring to 'h' with internal linkage cannot be exported}}