summaryrefslogtreecommitdiff
path: root/clang/test/SemaCXX/cxx-member-pointer-op.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/cxx-member-pointer-op.cpp')
-rw-r--r--clang/test/SemaCXX/cxx-member-pointer-op.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx-member-pointer-op.cpp b/clang/test/SemaCXX/cxx-member-pointer-op.cpp
new file mode 100644
index 0000000..f43d438
--- /dev/null
+++ b/clang/test/SemaCXX/cxx-member-pointer-op.cpp
@@ -0,0 +1,21 @@
+// 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;
+}
+