xref: /llvm-project/clang/test/Modules/GH109879-2.cpp (revision 0a42c7c6679bcc6f7be4b3d103670197acac96a9)
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 //
5 // RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm
6 // RUN: %clang_cc1 -std=c++20 %t/B.cppm -fprebuilt-module-path=%t -emit-module-interface -o %t/B.pcm
7 // RUN: %clang_cc1 -fsyntax-only -std=c++20 -fprebuilt-module-path=%t -verify %t/C.cpp
8 
9 //--- foo.h
10 struct Bar {};
11 extern "C" void foo(struct Bar);
12 
13 //--- A.cppm
14 module;
15 #include "foo.h"
16 export module A;
17 export extern "C" using ::foo;
18 //--- B.cppm
19 module;
20 import A;
21 export module B;
22 
23 //--- C.cpp
24 // expected-no-diagnostics
25 import B;
26 #include "foo.h"
27 void test() {
28   foo(Bar());
29 }
30