llvm-for-llvmta/tools/clang/test/SemaCXX/cxx-member-pointer-op.cpp

22 lines
533 B
C++
Raw Normal View History

2022-04-25 13:02:35 +02:00
// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
struct C {
static int (C::* a);
};
typedef void (C::*pmfc)();
void g(pmfc) {
C *c;
c->*pmfc(); // expected-error {{invalid use of pointer to member type after ->*}}
C c1;
c1.*pmfc(); // expected-error {{invalid use of pointer to member type after .*}}
c->*(pmfc()); // expected-error {{invalid use of pointer to member type after ->*}}
c1.*((pmfc())); // expected-error {{invalid use of pointer to member type after .*}}
}
int a(C* x) {
return x->*C::a;
}