1 // RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++98 -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++11 -o - %s | FileCheck %s
5 class A
{ protected: virtual ~A() {} };
6 class B
{ protected: virtual ~B() {} };
8 class C
: A
{ char x
; };
9 class D
: public A
{ short y
; };
10 class E
: public A
, public B
{ int z
; };
11 class F
: public virtual A
{ long long w
; };
12 class G
: virtual A
{ long long w
; };
14 class H
: public E
{ int a
; };
15 class I
: public F
{ char b
; };
17 class J
: public H
{ char q
; };
18 class K
: public C
, public B
{ char q
; };
20 class XA
: public A
{ };
21 class XB
: public A
{ };
22 class XC
: public virtual A
{ };
23 class X
: public XA
, public XB
, public XC
{ };
25 void test(A
*a
, B
*b
) {
26 volatile C
*ac
= dynamic_cast<C
*>(a
);
27 // CHECK: ptr @_ZTI1A, ptr @_ZTI1C, i64 -2)
28 volatile D
*ad
= dynamic_cast<D
*>(a
);
29 // CHECK: ptr @_ZTI1A, ptr @_ZTI1D, i64 0)
30 volatile E
*ae
= dynamic_cast<E
*>(a
);
31 // CHECK: ptr @_ZTI1A, ptr @_ZTI1E, i64 0)
32 volatile F
*af
= dynamic_cast<F
*>(a
);
33 // CHECK: ptr @_ZTI1A, ptr @_ZTI1F, i64 -1)
34 volatile G
*ag
= dynamic_cast<G
*>(a
);
35 // CHECK: ptr @_ZTI1A, ptr @_ZTI1G, i64 -2)
36 volatile H
*ah
= dynamic_cast<H
*>(a
);
37 // CHECK: ptr @_ZTI1A, ptr @_ZTI1H, i64 0)
38 volatile I
*ai
= dynamic_cast<I
*>(a
);
39 // CHECK: ptr @_ZTI1A, ptr @_ZTI1I, i64 -1)
40 volatile J
*aj
= dynamic_cast<J
*>(a
);
41 // CHECK: ptr @_ZTI1A, ptr @_ZTI1J, i64 0)
42 volatile K
*ak
= dynamic_cast<K
*>(a
);
43 // CHECK: ptr @_ZTI1A, ptr @_ZTI1K, i64 -2)
44 volatile X
*ax
= dynamic_cast<X
*>(a
);
45 // CHECK: ptr @_ZTI1A, ptr @_ZTI1X, i64 -1)
47 volatile E
*be
= dynamic_cast<E
*>(b
);
48 // CHECK: ptr @_ZTI1B, ptr @_ZTI1E, i64 8)
49 volatile G
*bg
= dynamic_cast<G
*>(b
);
50 // CHECK: ptr @_ZTI1B, ptr @_ZTI1G, i64 -2)
51 volatile J
*bj
= dynamic_cast<J
*>(b
);
52 // CHECK: ptr @_ZTI1B, ptr @_ZTI1J, i64 8)
53 volatile K
*bk
= dynamic_cast<K
*>(b
);
54 // CHECK: ptr @_ZTI1B, ptr @_ZTI1K, i64 16)