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