1a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar// RUN: %clang_cc1 -verify -fms-compatibility %s -fsyntax-only -o -
2a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar
3a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainarclass S {
4a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainarpublic:
5a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  __declspec(property(get=GetX,put=PutX)) int x[];
6a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  int GetX(int i, int j) { return i+j; } // expected-note {{'GetX' declared here}}
7a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  void PutX(int i, int j, int k) { j = i = k; } // expected-note {{'PutX' declared here}}
8a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar};
9a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar
10a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainarchar *ptr;
11a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainartemplate <typename T>
12a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainarclass St {
13a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainarpublic:
14a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  __declspec(property(get=GetX,put=PutX)) T x[];
15a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  T GetX(T i, T j) { return i+j; } // expected-note 3 {{'GetX' declared here}}
16a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  T PutX(T i, T j, T k) { return j = i = k; }  // expected-note 2 {{'PutX' declared here}}
17a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  ~St() {
18a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar    x[1] = 0; // expected-error {{too few arguments to function call, expected 3, have 2}}
19a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar    x[2][3] = 4;
20a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar    ++x[2][3];
21a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar    x[1][2] = x[3][4][5]; // expected-error {{too many arguments to function call, expected 2, have 3}}
22a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar    ptr = x[1][2] = x[3][4]; // expected-error {{assigning to 'char *' from incompatible type 'int'}}
23a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  }
24a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar};
25a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar
26a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar// CHECK-LABEL: main
27a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainarint main(int argc, char **argv) {
28a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  S *p1 = 0;
29a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  St<float> *p2 = 0;
30a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  St<int> a; // expected-note {{in instantiation of member function 'St<int>::~St' requested here}}
31a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  int j = (p1->x)[223][11][2]; // expected-error {{too many arguments to function call, expected 2, have 3}}
32a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  (p1->x[23]) = argc; // expected-error {{too few arguments to function call, expected 3, have 2}}
33a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  float j1 = (p2->x); // expected-error {{too few arguments to function call, expected 2, have 0}}
34a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  ((p2->x)[23])[1][2] = *argv; // expected-error {{too many arguments to function call, expected 3, have 4}}
35a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  argv = p2->x[11][22] = argc; // expected-error {{assigning to 'char **' from incompatible type 'float'}}
36a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar  return ++(((p2->x)[23])); // expected-error {{too few arguments to function call, expected 2, have 1}}
37a4de17562d13d7a8188108243c4cfbd52f33229aPirama Arumuga Nainar}
38