1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -emit-llvm -o - | FileCheck %s
2 
3 extern "C" int printf(...);
4 
5 struct M {
6   M() { printf("M()\n"); }
7   M(int i) { iM = i; printf("M(%d)\n", i); }
8   int iM;
9   void MPR() {printf("iM = %d\n", iM); };
10 };
11 
12 struct P {
13   P() { printf("P()\n"); }
14   P(int i) { iP = i; printf("P(%d)\n", i); }
15   int iP;
16   void PPR() {printf("iP = %d\n", iP); };
17 };
18 
19 struct Q {
20   Q() { printf("Q()\n"); }
21   Q(int i) { iQ = i; printf("Q(%d)\n", i); }
22   int iQ;
23   void QPR() {printf("iQ = %d\n", iQ); };
24 };
25 
26 struct N : M , P, Q {
27   N() : f1(1.314), P(2000), ld(00.1234+f1), M(1000), Q(3000),
28         d1(3.4567), i1(1234), m1(100) { printf("N()\n"); }
29   M m1;
30   M m2;
31   float f1;
32   int i1;
33   float d1;
34   void PR() {
35     printf("f1 = %f d1 = %f i1 = %d ld = %f \n", f1,d1,i1, ld);
36     MPR();
37     PPR();
38     QPR();
39     printf("iQ = %d\n", iQ);
40     printf("iP = %d\n", iP);
41     printf("iM = %d\n", iM);
42     // FIXME. We don't yet support this syntax.
43     // printf("iQ = %d\n", (*this).iQ);
44     printf("iQ = %d\n", this->iQ);
45     printf("iP = %d\n", this->iP);
46     printf("iM = %d\n", this->iM);
47   }
48   float ld;
49   float ff;
50   M arr_m[3];
51   P arr_p[1][3];
52   Q arr_q[2][3][4];
53 };
54 
55 int main() {
56   M m1;
57 
58   N n1;
59   n1.PR();
60 }
61 
62 // PR5826
63 template <class T> struct A {
64   A() {}
65   A(int) {}
66   A(const A&) {}
67   ~A() {}
68   operator int() {return 0;}
69 };
70 
71 // CHECK: define void @_Z1fv()
72 void f() {
73   // CHECK: call void @_ZN1AIsEC1Ei
74   A<short> a4 = 97;
75 
76   // CHECK-NEXT: store i32 17
77   int i = 17;
78 
79   // CHECK-NEXT: call void @_ZN1AIsED1Ev
80   // CHECK-NOT: call void @_ZN1AIsED1Ev
81   // CHECK: ret void
82 }
83 
84 template<typename T>
85 struct X {
86   X(const X &);
87 
88   T *start;
89   T *end;
90 };
91 
92 template<typename T> struct X;
93 
94 // Make sure that the instantiated constructor initializes start and
95 // end properly.
96 // CHECK: define linkonce_odr void @_ZN1XIiEC2ERKS0_
97 // CHECK: {{store.*null}}
98 // CHECK: {{store.*null}}
99 // CHECK: ret
100 template<typename T>
101 X<T>::X(const X &other) : start(0), end(0) { }
102 
103 X<int> get_X(X<int> x) { return x; }
104