1 // { dg-do assemble } 2 // { dg-options "" } 3 // General test for operator overloading permissiveness. 4 5 typedef __SIZE_TYPE__ size_t; 6 7 struct A { 8 int operator?:(int a, int b); // { dg-error "expected type-specifier" } 9 static int operator()(int a); // { dg-error "must be a nonstatic member" } 10 static int operator+(A,A); // { dg-error "either a non-static member" } 11 int operator+(int a, int b = 1); // { dg-error "either zero or one" } 12 int operator++(char); // { dg-error "must take 'int'" } 13 void operator delete (void *); 14 void operator delete (void *, unsigned long); 15 }; 16 17 struct B { 18 void * operator new (size_t, void *); 19 int operator++(int = 0); 20 int operator+ (int); 21 void operator()(); 22 char * operator[](int); 23 B * operator->(); 24 }; 25 26 int operator-(int a, int b); // { dg-error "argument of class or" } 27 28 void * operator new (A a); // { dg-error "first parameter" } 29 void operator delete (A a); // { dg-error "first parameter" } 30 31 char * operator char * (int); // { dg-error "return type" "ret" } 32 // { dg-error "nonstatic member function" "mem" { target *-*-* } 31 } 33