member-function-pointer-calls.cpp revision 51591bed1050827c23691cf36e2e1621dfe08b00
1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s 2struct A { 3 virtual int vf1() { return 1; } 4 virtual int vf2() { return 2; } 5}; 6 7int f(A* a, int (A::*fp)()) { 8 return (a->*fp)(); 9} 10 11// CHECK: define i32 @_Z2g1v() 12int g1() { 13 A a; 14 15 // CHECK: call i32 @_ZN1A3vf1Ev 16 // CHECK-NEXT: ret i32 17 return f(&a, &A::vf1); 18} 19 20int g2() { 21 A a; 22 23 // CHECK: call i32 @_ZN1A3vf2Ev 24 // CHECK-NEXT: ret i32 25 return f(&a, &A::vf2); 26} 27