1 // RUN: %clang_cc1 -ast-print -verify -triple=x86_64-pc-win32 -fms-compatibility %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple=x86_64-pc-win32 -fms-compatibility -emit-pch -o %t %s
3 // RUN: %clang_cc1 -triple=x86_64-pc-win32 -fms-compatibility -include-pch %t -verify %s -ast-print -o - | FileCheck %s
4 // expected-no-diagnostics
5
6 #ifndef HEADER
7 #define HEADER
8
9 class Test1 {
10 private:
11 int x_;
12
13 public:
Test1(int x)14 Test1(int x) : x_(x) {}
15 __declspec(property(get = get_x)) int X;
get_x() const16 int get_x() const { return x_; }
GetTest1()17 static Test1 *GetTest1() { return new Test1(10); }
18 };
19
20 class S {
21 public:
22 __declspec(property(get=GetX,put=PutX)) int x[];
GetX(int i,int j)23 int GetX(int i, int j) { return i+j; }
PutX(int i,int j,int k)24 void PutX(int i, int j, int k) { j = i = k; }
25 };
26
27 template <typename T>
28 class St {
29 public:
30 __declspec(property(get=GetX,put=PutX)) T x[];
GetX(T i,T j)31 T GetX(T i, T j) { return i+j; }
PutX(T i,T j,T k)32 T PutX(T i, T j, T k) { return j = i = k; }
~St()33 ~St() { x[0][0] = x[1][1]; }
34 };
35
36 // CHECK: this->x[0][0] = this->x[1][1];
37 // CHECK: this->x[0][0] = this->x[1][1];
38
39 // CHECK-LABEL: main
main(int argc,char ** argv)40 int main(int argc, char **argv) {
41 S *p1 = 0;
42 St<float> *p2 = 0;
43 // CHECK: St<int> a;
44 St<int> a;
45 // CHECK-NEXT: int j = (p1->x)[223][11];
46 int j = (p1->x)[223][11];
47 // CHECK-NEXT: (p1->x[23])[1] = j;
48 (p1->x[23])[1] = j;
49 // CHECK-NEXT: float j1 = (p2->x[223][11]);
50 float j1 = (p2->x[223][11]);
51 // CHECK-NEXT: ((p2->x)[23])[1] = j1;
52 ((p2->x)[23])[1] = j1;
53 // CHECK-NEXT: ++(((p2->x)[23])[1]);
54 ++(((p2->x)[23])[1]);
55 // CHECK-NEXT: j1 = ((p2->x)[23])[1] = j1;
56 j1 = ((p2->x)[23])[1] = j1;
57 // CHECK-NEXT: return Test1::GetTest1()->X;
58 return Test1::GetTest1()->X;
59 }
60 #endif // HEADER
61