diff options
Diffstat (limited to 'test/CodeGenCXX/ptr-to-member-function.cpp')
-rw-r--r-- | test/CodeGenCXX/ptr-to-member-function.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/CodeGenCXX/ptr-to-member-function.cpp b/test/CodeGenCXX/ptr-to-member-function.cpp index 1e396e9..1501908 100644 --- a/test/CodeGenCXX/ptr-to-member-function.cpp +++ b/test/CodeGenCXX/ptr-to-member-function.cpp @@ -9,8 +9,14 @@ extern "C" int printf(...); struct A { int Ai; +bool foo(int* arg) const; }; +bool A::foo(int* arg) const { + printf("A::foo(%d)\n", *arg); + return true; +} + struct B : public A { void bf() { printf("B::bf called\n"); } }; @@ -40,10 +46,22 @@ void test2(X x) g(x); } +struct B1 { + bool (A::*pmf)(int*) const; + + B1(int i) : pmf(&A::foo), im(i) { + ((A*)this->*pmf)(&im); + } + + int im; +}; + int main() { X x; test2(x); + B1 b = B1(1); + B1 c = B1(2); } // CHECK-LP64: call __ZN1XcvM1BFvvEEv |