xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/cxx-member-init.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Test this without pch.
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -DSOURCE -fsyntax-only -emit-llvm -o - %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // Test with pch.
5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -emit-pch -o %t %s
6*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -include-pch %t -fsyntax-only -emit-llvm -o - %s
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc #ifdef HEADER
9*f4a2713aSLionel Sambuc int n;
10*f4a2713aSLionel Sambuc struct S {
11*f4a2713aSLionel Sambuc   int *p = &m;
12*f4a2713aSLionel Sambuc   int &m = n;
13*f4a2713aSLionel Sambuc   S *that = this;
14*f4a2713aSLionel Sambuc };
15*f4a2713aSLionel Sambuc template<typename T> struct X { T t {0}; };
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc struct v_t { };
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc struct m_t
20*f4a2713aSLionel Sambuc {
21*f4a2713aSLionel Sambuc     struct { v_t v; };
m_tm_t22*f4a2713aSLionel Sambuc     m_t() { }
23*f4a2713aSLionel Sambuc };
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc #endif
26*f4a2713aSLionel Sambuc 
27*f4a2713aSLionel Sambuc #ifdef SOURCE
28*f4a2713aSLionel Sambuc S s;
29*f4a2713aSLionel Sambuc 
30*f4a2713aSLionel Sambuc struct E { explicit E(int); };
31*f4a2713aSLionel Sambuc X<E> x;
32*f4a2713aSLionel Sambuc 
test()33*f4a2713aSLionel Sambuc m_t *test() {
34*f4a2713aSLionel Sambuc   return new m_t;
35*f4a2713aSLionel Sambuc }
36*f4a2713aSLionel Sambuc 
37*f4a2713aSLionel Sambuc #elif HEADER
38*f4a2713aSLionel Sambuc #undef HEADER
39*f4a2713aSLionel Sambuc #define SOURCE
40*f4a2713aSLionel Sambuc #endif
41