[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / cxx-member-init.cpp
blob52ea7bb174a03341018c820011fed523f4f940b7
1 // Test this without pch.
2 // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -DSOURCE -emit-llvm -o - %s
4 // Test with pch.
5 // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -emit-pch -o %t %s
6 // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -include-pch %t -emit-llvm -o - %s
8 // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -emit-pch -fpch-instantiate-templates -o %t %s
9 // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -include-pch %t -emit-llvm -o - %s
11 #ifdef HEADER
12 int n;
13 struct S {
14 int *p = &m;
15 int &m = n;
16 S *that = this;
18 template<typename T> struct X { T t {0}; };
20 struct v_t { };
22 struct m_t
24 struct { v_t v; };
25 m_t() { }
28 #endif
30 #ifdef SOURCE
31 S s;
33 struct E { explicit E(int); };
34 X<E> x;
36 m_t *test() {
37 return new m_t;
40 #elif HEADER
41 #undef HEADER
42 #define SOURCE
43 #endif