member-function-pointers.cpp revision ee383163a656a7e8d99efa4e5ee98c705c7fdf89
1// RUN: clang-cc %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s
2
3struct A { int a; };
4struct B { int b; };
5struct C : B, A { };
6
7void (A::*pa)();
8void (A::*volatile vpa)();
9void (B::*pb)();
10void (C::*pc)();
11
12void f() {
13  // CHECK: store i64 0, i64* getelementptr inbounds (%0* @pa, i32 0, i32 0)
14  // CHECK: store i64 0, i64* getelementptr inbounds (%0* @pa, i32 0, i32 1)
15  pa = 0;
16
17  // CHECK: volatile store i64 0, i64* getelementptr inbounds (%0* @vpa, i32 0, i32 0)
18  // CHECK: volatile store i64 0, i64* getelementptr inbounds (%0* @vpa, i32 0, i32 1)
19  vpa = 0;
20
21  // CHECK: store i64 %0, i64* getelementptr inbounds (%0* @pc, i32 0, i32 0)
22  // CHECK: [[ADJ:%[a-zA-Z0-9]+]] = add i64 %1, 4
23  // CHECK: store i64 [[ADJ]], i64* getelementptr inbounds (%0* @pc, i32 0, i32 1)
24  pc = pa;
25}
26