ptr-to-datamember.cpp revision f51dc64f90851f636302dbaaf3f52c0524cdac36
1// RUN: clang-cc -emit-llvm -o - %s
2
3extern "C" int printf(...);
4
5struct V {
6  double d;
7  int iV;
8};
9
10struct B  : virtual V{
11  double d;
12  int iB;
13};
14
15struct B1  : virtual V{
16  double d;
17  int iB1;
18};
19
20class A  : public B, public B1 {
21public:
22  A() : f(1.0), d(2.0), Ai(3) {}
23  float f;
24  double d;
25  int Ai;
26};
27
28int main()
29{
30  A a1;
31  int A::* pa = &A::Ai;
32  float A::* pf = &A::f;
33  double A::* pd = &A::d;
34  printf("%d %d %d\n", &A::Ai, &A::f, &A::d);
35  printf("%d\n", &A::B::iB);
36  printf("%d\n", &A::B1::iB1);
37  printf("%d\n", &A::f);
38  printf("%d\n", &A::B::iV);
39  printf("%d\n", &A::B1::iV);
40  printf("%d\n", &A::B::V::iV);
41  printf("%d\n", &A::B1::V::iV);
42  printf("%d, %f, %f  \n", a1.*pa, a1.*pf, a1.*pd);
43}
44