aboutsummaryrefslogtreecommitdiff
path: root/test/C++Frontend/pointer_method.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/C++Frontend/pointer_method.cpp')
-rw-r--r--test/C++Frontend/pointer_method.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/test/C++Frontend/pointer_method.cpp b/test/C++Frontend/pointer_method.cpp
index d499a7ef09..a8f76ab20c 100644
--- a/test/C++Frontend/pointer_method.cpp
+++ b/test/C++Frontend/pointer_method.cpp
@@ -1,8 +1,23 @@
-struct B { int i(); int j(); };
+#include <stdio.h>
-void foo(int (B::*Fn)());
+struct B {
+ int X;
+ void i() {
+ printf("i, %d\n", X);
+ }
+ void j() {
+ printf("j, %d\n", X);
+ }
+};
-void test() {
- foo(&B::i);
- foo(&B::j);
+void foo(int V, void (B::*Fn)()) {
+ B b; b.X = V;
+ (b.*Fn)();
+}
+
+int main() {
+ foo(4, &B::i);
+ foo(6, &B::j);
+ foo(-1, &B::i);
+ return 0;
}