1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s
2// RUN: %clang_cc1 %s -triple=x86_64-windows-gnu -emit-llvm -o - | FileCheck %s -check-prefix MINGW64
3struct A {
4  virtual int vf1() { return 1; }
5  virtual int vf2() { return 2; }
6};
7
8int f(A* a, int (A::*fp)()) {
9  return (a->*fp)();
10}
11
12// CHECK-LABEL: define i32 @_Z2g1v()
13// CHECK: ret i32 1
14// MINGW64-LABEL: define i32 @_Z2g1v()
15// MINGW64: call i32 @_Z1fP1AMS_FivE(%struct.A* %{{.*}}, { i64, i64 }* %{{.*}})
16int g1() {
17  A a;
18  return f(&a, &A::vf1);
19}
20
21// CHECK-LABEL: define i32 @_Z2g2v()
22// CHECK: ret i32 2
23// MINGW64-LABEL: define i32 @_Z2g2v()
24// MINGW64: call i32 @_Z1fP1AMS_FivE(%struct.A* %{{.*}}, { i64, i64 }* %{{.*}})
25int g2() {
26  A a;
27  return f(&a, &A::vf2);
28}
29