1 // Tests that the definition in private module fragment is not reachable to its users.
5 // RUN: split-file %s %t
7 // RUN: %clang_cc1 -std=c++20 %t/Private.cppm -emit-module-interface \
8 // RUN: -o %t/Private.pcm
9 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp \
10 // RUN: -DTEST_BADINLINE -verify -fsyntax-only
12 // Test again with reduced BMI.
15 // RUN: split-file %s %t
17 // RUN: %clang_cc1 -std=c++20 %t/Private.cppm -emit-reduced-module-interface \
18 // RUN: -o %t/Private.pcm
19 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp \
20 // RUN: -DTEST_BADINLINE -verify -fsyntax-only
23 export module Private
;
25 inline void fn_m(); // expected-error {{un-exported inline function not defined before the private module fragment}}
26 // expected-note@Private.cppm:13 {{private module fragment begins here}}
32 fn_s(); // OK, call to static function in same translation unit
34 fn_m(); // fn_m is not OK.
37 export X
*factory(); // OK
40 struct X
{}; // definition not reachable from importers of A
50 X x
; // expected-error 1+{{missing '#include'; 'X' must be defined before it is used}}
51 // expected-note@Private.cppm:18 1+{{definition here is not reachable}}