1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 2 3 struct S { 4 int i; 5 6 int mem(int); 7 }; 8 9 int foo(int S::* ps, S *s) 10 { 11 return (s->*ps)(1); // expected-error {{called object type 'int' is not a function or function pointer}} 12 } 13 14 struct S2 { 15 int bitfield : 1; 16 }; 17 18 int S2::*pf = &S2::bitfield; // expected-error {{address of bit-field requested}} 19 20 struct S3 { 21 void m(); 22 }; 23 24 void f3(S3* p, void (S3::*m)()) { 25 p->*m; // expected-error {{reference to non-static member function must be called}} 26 (void)(p->*m); // expected-error {{reference to non-static member function must be called}} 27 (void)(void*)(p->*m); // expected-error {{reference to non-static member function must be called}} expected-error {{cannot cast from type 'void' to pointer type 'void *'}} 28 (void)reinterpret_cast<void*>(p->*m); // expected-error {{reference to non-static member function must be called}} expected-error {{reinterpret_cast from 'void' to 'void *' is not allowed}} 29 if (p->*m) {} // expected-error {{reference to non-static member function must be called}} expected-error {{value of type 'void' is not contextually convertible to 'bool'}} 30 if (!(p->*m)) {} // expected-error {{reference to non-static member function must be called}} expected-error {{invalid argument type 'void' to unary expression}} 31 if (p->m) {}; // expected-error {{reference to non-static member function must be called}} expected-error {{value of type 'void' is not contextually convertible to 'bool'}} 32 if (!p->m) {}; // expected-error {{reference to non-static member function must be called}} expected-error {{invalid argument type 'void' to unary expression}} 33 } 34