[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / merge-template-members-parent.cpp
blobc51483b8428dd46ba43a9a307477c858b81c8aab
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -emit-obj -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %t/merge.cpp -o %t/merge.o
7 //--- V.h
8 #ifndef V_H
9 #define V_H
10 template <typename T>
11 struct V {
12 ~V() {}
14 #endif
16 //--- A.h
17 #include "V.h"
19 void A(const V<unsigned long> &v);
21 //--- B.h
22 #include "V.h"
24 inline V<unsigned long> B() {
25 return {};
28 //--- C.h
29 #include "V.h"
31 #include "A.h"
33 class C {
34 public:
35 C(const V<unsigned long> &v) {
36 V<unsigned long> v2;
40 C GetC() {
41 return {{}};
44 // This include *MUST* come last.
45 #include "B.h"
47 //--- module.modulemap
48 module "V" { header "V.h" export * }
49 module "A" { header "A.h" export * }
50 module "B" { header "B.h" export * }
51 module "C" { header "C.h" export * }
53 //--- merge.cpp
54 #include "C.h"
56 template <typename T>
57 C GetC_main() {
58 return {{}};
61 void f() {
62 GetC_main<float>();
63 GetC();