[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / pr68702.cpp
blobd32f946910f4fb8b8e81c7a856c0e86a2aca40dc
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -std=c++20 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %t/main.cpp -o %t/main.o
7 //--- V.h
8 #ifndef V_H
9 #define V_H
11 class A {
12 public:
13 constexpr A() { }
14 constexpr ~A() { }
17 template <typename T>
18 class V {
19 public:
20 V() = default;
22 constexpr V(int n, const A& a = A()) {}
25 #endif
27 //--- inst1.h
28 #include "V.h"
30 static void inst1() {
31 V<int> v;
34 //--- inst2.h
35 #include "V.h"
37 static void inst2() {
38 V<int> v(100);
41 //--- module.modulemap
42 module "M" {
43 export *
44 module "V.h" {
45 export *
46 header "V.h"
48 module "inst1.h" {
49 export *
50 header "inst1.h"
54 module "inst2.h" {
55 export *
56 header "inst2.h"
59 //--- main.cpp
60 #include "V.h"
61 #include "inst2.h"
63 static void m() {
64 static V<int> v(100);