Commit | Line | Data |
---|---|---|
10abb1d4 JB |
1 | struct A |
2 | { | |
3 | int a; | |
4 | A (int aa): a (aa) {} | |
5 | }; | |
6 | ||
7 | struct B: public A | |
8 | { | |
9 | int b; | |
10 | B (int aa, int bb): A (aa), b(bb) {} | |
11 | }; | |
12 | ||
4e8f195d TT |
13 | |
14 | struct Alpha | |
15 | { | |
16 | virtual void x() { } | |
17 | }; | |
18 | ||
19 | struct Gamma | |
20 | { | |
21 | }; | |
22 | ||
23 | struct Derived : public Alpha | |
24 | { | |
25 | }; | |
26 | ||
27 | struct VirtuallyDerived : public virtual Alpha | |
28 | { | |
29 | }; | |
30 | ||
31 | struct DoublyDerived : public VirtuallyDerived, | |
32 | public virtual Alpha, | |
33 | public Gamma | |
34 | { | |
35 | }; | |
36 | ||
608b4967 TT |
37 | // Confuse a simpler approach. |
38 | ||
39 | double | |
40 | decltype(int x) | |
41 | { | |
42 | return x + 2.0; | |
43 | } | |
44 | ||
10abb1d4 JB |
45 | int |
46 | main (int argc, char **argv) | |
47 | { | |
48 | A *a = new B(42, 1729); | |
49 | B *b = (B *) a; | |
f0050c20 AR |
50 | A &ar = *b; |
51 | B &br = (B&)ar; | |
10abb1d4 | 52 | |
4e8f195d TT |
53 | Derived derived; |
54 | DoublyDerived doublyderived; | |
55 | ||
56 | Alpha *ad = &derived; | |
57 | Alpha *add = &doublyderived; | |
58 | ||
608b4967 TT |
59 | double y = decltype(2); |
60 | ||
10abb1d4 JB |
61 | return 0; /* breakpoint spot: casts.exp: 1 */ |
62 | } |