brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · cda350e Raw
43 lines · cpp
1// RUN: %clang_cc1 -verify -fms-compatibility %s -fsyntax-only -o -2 3class S {4public:5  __declspec(property(get=GetX,put=PutX)) int x[];6  int GetX(int i, int j) { return i+j; } // expected-note {{'GetX' declared here}}7  void PutX(int i, int j, int k) { j = i = k; } // expected-note {{'PutX' declared here}}8  __declspec(property(get=GetY,put=PutY)) int y[][][];9  int GetY(int i, int j) { return i+j; } // expected-note {{'GetY' declared here}}10  void PutY(int i, int j, int k) { j = i = k; } // expected-note {{'PutY' declared here}}11};12 13char *ptr;14template <typename T>15class St {16public:17  __declspec(property(get=GetX,put=PutX)) T x[];18  T GetX(T i, T j) { return i+j; } // expected-note 3 {{'GetX' declared here}}19  T PutX(T i, T j, T k) { return j = i = k; }  // expected-note 2 {{'PutX' declared here}}20  ~St() {21    x[1] = 0; // expected-error {{too few arguments to function call, expected 3, have 2}}22    x[2][3] = 4;23    ++x[2][3];24    x[1][2] = x[3][4][5]; // expected-error {{too many arguments to function call, expected 2, have 3}}25    ptr = x[1][2] = x[3][4]; // expected-error {{incompatible integer to pointer conversion assigning to 'char *' from 'int'}}26  }27};28 29// CHECK-LABEL: main30int main(int argc, char **argv) {31  S *p1 = 0;32  St<float> *p2 = 0;33  St<int> a; // expected-note {{in instantiation of member function 'St<int>::~St' requested here}}34  int j = (p1->x)[223][11][2]; // expected-error {{too many arguments to function call, expected 2, have 3}}35  (p1->x[23]) = argc; // expected-error {{too few arguments to function call, expected 3, have 2}}36  int k = (p1->y)[223][11][2][4]; // expected-error {{too many arguments to function call, expected 2, have 4}}37  (p1->y[23]) = argc; // expected-error {{too few arguments to function call, expected 3, have 2}}38  float j1 = (p2->x); // expected-error {{too few arguments to function call, expected 2, have 0}}39  ((p2->x)[23])[1][2] = *argv; // expected-error {{too many arguments to function call, expected 3, have 4}}40  argv = p2->x[11][22] = argc; // expected-error {{assigning to 'char **' from incompatible type 'float'}}41  return ++(((p2->x)[23])); // expected-error {{too few arguments to function call, expected 2, have 1}}42}43