// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s &&
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -O0 -S %s -o %t-32.s &&
// RUN: FileCheck -check-prefix LP32 -input-file=%t-32.s %s &&
// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -O3 -S %s -o %t-O3-64.s &&
// RUN: FileCheck -check-prefix LPOPT64 --input-file=%t-O3-64.s %s &&
// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -O3 -S %s -o %t-O3-32.s &&
// RUN: FileCheck -check-prefix LPOPT32 -input-file=%t-O3-32.s %s &&
// RUN: true
struct B {
virtual void bar1();
virtual void bar2();
int b;
};
void B::bar1() { }
void B::bar2() { }
struct C {
virtual void bee1();
virtual void bee2();
};
void C::bee1() { }
void C::bee2() { }
struct D {
virtual void boo();
};
void D::boo() { }
struct D1 {
virtual void bar();
virtual void bar2();
virtual void bar3();
virtual void bar4();
virtual void bar5();
void *d1;
};
void D1::bar() { }
class F : virtual public D1, virtual public D {
public:
virtual void foo();
void *f;
};
void F::foo() { }
int j;
void test2() {
F f;
static int sz = (char *)(&f.f) - (char *)(&f);
j = sz;
// FIXME: These should result in a frontend constant a la fold, no run time
// initializer
// CHECK-LPOPT32: movl $4, __ZZ5test2vE2sz
// CHECK-LPOPT64: movl $8, __ZZ5test2vE2sz(%rip)
}
static_assert(sizeof(F) == sizeof(void*)*4, "invalid vbase size");
struct E {
int e;
};
static_assert (sizeof (C) == (sizeof(void *)), "vtable pointer layout");
class A : public E, public B, public C {
public:
virtual void foo1();
virtual void foo2();
A() { }
int a;
} *ap;
void A::foo1() { }
void A::foo2() { }
int main() {
A a;
B b;
ap