[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / GH109879-2.cpp
blobccec57839898a2f28b845e5fb118b07902b769fe
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 //--- foo.h
10 struct Bar {};
11 extern "C" void foo(struct Bar);
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;
23 //--- C.cpp
24 // expected-no-diagnostics
25 import B;
26 #include "foo.h"
27 void test() {
28 foo(Bar());