summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/member-pointer-cast.cpp
blob: 4937b037de536a48216fd33f1a4d9fc4432eb256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s

struct A { int a; };
struct B { int b; };
struct C : B, A { };

int A::*pa;
int C::*pc;

void f() {
  // CHECK: store i64 -1, i64* @pa
  pa = 0;

  // CHECK: [[ADJ:%[a-zA-Z0-9\.]+]] = add i64 {{.*}}, 4
  // CHECK: store i64 [[ADJ]], i64* @pc
  pc = pa;

  // CHECK: [[ADJ:%[a-zA-Z0-9\.]+]] = sub i64 {{.*}}, 4
  // CHECK: store i64 [[ADJ]], i64* @pa
  pa = static_cast<int A::*>(pc);
}