[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / GH109879-1.cpp
blob72cfb11081e48228a4ed575352956ab329c18286
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
9 //--- A.cppm
10 export module A;
11 export extern "C" void foo(struct Bar);
13 //--- B.cppm
14 module;
15 import A;
16 export module B;
18 //--- C.cpp
19 import B;
20 struct Bar {};
21 void test() {
22 foo(Bar());
23 // expected-error@-1 {{declaration of 'foo' must be imported}}
24 // expected-note@A.cppm:2 {{declaration here is not visible}}