xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/cxx-member-pointer-op.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct C {
4*f4a2713aSLionel Sambuc   static int (C::* a);
5*f4a2713aSLionel Sambuc };
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc typedef void (C::*pmfc)();
8*f4a2713aSLionel Sambuc 
g(pmfc)9*f4a2713aSLionel Sambuc void g(pmfc) {
10*f4a2713aSLionel Sambuc   C *c;
11*f4a2713aSLionel Sambuc   c->*pmfc(); // expected-error {{invalid use of pointer to member type after ->*}}
12*f4a2713aSLionel Sambuc   C c1;
13*f4a2713aSLionel Sambuc   c1.*pmfc(); // expected-error {{invalid use of pointer to member type after .*}}
14*f4a2713aSLionel Sambuc   c->*(pmfc()); // expected-error {{invalid use of pointer to member type after ->*}}
15*f4a2713aSLionel Sambuc   c1.*((pmfc())); // expected-error {{invalid use of pointer to member type after .*}}
16*f4a2713aSLionel Sambuc }
17*f4a2713aSLionel Sambuc 
a(C * x)18*f4a2713aSLionel Sambuc int a(C* x) {
19*f4a2713aSLionel Sambuc   return x->*C::a;
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc 
22