Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 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: |
| 14 | Test1(int x) : x_(x) {} |
| 15 | __declspec(property(get = get_x)) int X; |
| 16 | int get_x() const { return x_; } |
| 17 | static Test1 *GetTest1() { return new Test1(10); } |
| 18 | }; |
| 19 | |
| 20 | class S { |
| 21 | public: |
| 22 | __declspec(property(get=GetX,put=PutX)) int x[]; |
| 23 | int GetX(int i, int j) { return i+j; } |
| 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[]; |
| 31 | T GetX(T i, T j) { return i+j; } |
Alexey Bataev | 60520e2 | 2015-12-10 04:38:18 +0000 | [diff] [blame] | 32 | T PutX(T i, T j, T k) { return j = i = k; } |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 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 |
| 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]); |
Alexey Bataev | 60520e2 | 2015-12-10 04:38:18 +0000 | [diff] [blame] | 55 | // CHECK-NEXT: j1 = ((p2->x)[23])[1] = j1; |
| 56 | j1 = ((p2->x)[23])[1] = j1; |
Alexey Bataev | f763027 | 2015-11-25 12:01:00 +0000 | [diff] [blame] | 57 | // CHECK-NEXT: return Test1::GetTest1()->X; |
| 58 | return Test1::GetTest1()->X; |
| 59 | } |
| 60 | #endif // HEADER |