[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / libcxxabi / test / dynamic_cast3.pass.cpp
blob95e2caa93b04a4cc26a42e79d263bd08467527fc
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include <cassert>
10 #include "support/timer.h"
12 // This test explicitly tests dynamic cast with types that have inaccessible
13 // bases.
14 #if defined(__clang__)
15 # pragma clang diagnostic ignored "-Winaccessible-base"
16 #elif defined(__GNUC__)
17 # pragma GCC diagnostic ignored "-Winaccessible-base"
18 #endif
22 A1 A2 A3
26 namespace t1
29 struct A1
31 char _[43981];
32 virtual ~A1() {}
34 A1* getA1() {return this;}
37 struct A2
39 char _[34981];
40 virtual ~A2() {}
42 A2* getA2() {return this;}
45 struct A3
47 char _[93481];
48 virtual ~A3() {}
50 A3* getA3() {return this;}
53 void test()
55 A1 a1;
56 A2 a2;
57 A3 a3;
58 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
59 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
60 assert(dynamic_cast<A1*>(a3.getA3()) == 0);
61 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
62 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
63 assert(dynamic_cast<A2*>(a3.getA3()) == 0);
64 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
65 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
66 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
69 } // t1
73 A1 A2
79 namespace t2
82 struct A1
84 char _[43981];
85 virtual ~A1() {}
87 A1* getA1() {return this;}
90 struct A2
92 char _[34981];
93 virtual ~A2() {}
95 A2* getA2() {return this;}
98 struct A3
99 : public A1
101 char _[93481];
102 virtual ~A3() {}
104 A3* getA3() {return this;}
107 void test()
109 A1 a1;
110 A2 a2;
111 A3 a3;
112 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
113 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
114 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
115 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
117 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
118 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
119 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
120 assert(dynamic_cast<A2*>(a3.getA3()) == 0);
122 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
123 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
124 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
125 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
128 } // t2
130 namespace t3
133 struct A1
135 char _[43981];
136 virtual ~A1() {}
138 A1* getA1() {return this;}
141 struct A2
143 char _[34981];
144 virtual ~A2() {}
146 A2* getA2() {return this;}
149 struct A3
150 : public virtual A1
152 char _[93481];
153 virtual ~A3() {}
155 A3* getA3() {return this;}
158 void test()
160 A1 a1;
161 A2 a2;
162 A3 a3;
163 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
164 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
165 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
166 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
168 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
169 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
170 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
171 assert(dynamic_cast<A2*>(a3.getA3()) == 0);
173 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
174 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
175 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
176 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
179 } // t3
181 namespace t4
184 struct A1
186 char _[43981];
187 virtual ~A1() {}
189 A1* getA1() {return this;}
192 struct A2
194 char _[34981];
195 virtual ~A2() {}
197 A2* getA2() {return this;}
200 struct A3
201 : private A1
203 char _[93481];
204 virtual ~A3() {}
206 A1* getA1() {return this;}
207 A3* getA3() {return this;}
210 void test()
212 A1 a1;
213 A2 a2;
214 A3 a3;
215 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
216 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
217 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
219 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
220 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
221 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
222 assert(dynamic_cast<A2*>(a3.getA3()) == 0);
224 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
225 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
226 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
227 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
230 } // t4
232 namespace t5
235 struct A1
237 char _[43981];
238 virtual ~A1() {}
240 A1* getA1() {return this;}
243 struct A2
245 char _[34981];
246 virtual ~A2() {}
248 A2* getA2() {return this;}
251 struct A3
252 : private virtual A1
254 char _[93481];
255 virtual ~A3() {}
257 A1* getA1() {return this;}
258 A3* getA3() {return this;}
261 void test()
263 A1 a1;
264 A2 a2;
265 A3 a3;
266 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
267 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
268 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
270 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
271 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
272 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
273 assert(dynamic_cast<A2*>(a3.getA3()) == 0);
275 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
276 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
277 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
278 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
281 } // t5
285 A1 A2
291 namespace t6
294 struct A1
296 char _[43981];
297 virtual ~A1() {}
299 A1* getA1() {return this;}
302 struct A2
304 char _[34981];
305 virtual ~A2() {}
307 A2* getA2() {return this;}
310 struct A3
311 : public A1,
312 public A2
314 char _[93481];
315 virtual ~A3() {}
317 A1* getA1() {return this;}
318 A2* getA2() {return this;}
319 A3* getA3() {return this;}
322 void test()
324 A1 a1;
325 A2 a2;
326 A3 a3;
327 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
328 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
329 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
330 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA1());
331 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
333 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
334 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
335 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
336 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
337 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
339 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
340 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
341 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
342 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
343 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
346 } // t6
348 namespace t7
351 struct A1
353 char _[43981];
354 virtual ~A1() {}
356 A1* getA1() {return this;}
359 struct A2
361 char _[34981];
362 virtual ~A2() {}
364 A2* getA2() {return this;}
367 struct A3
368 : public virtual A1,
369 public A2
371 char _[93481];
372 virtual ~A3() {}
374 A1* getA1() {return this;}
375 A2* getA2() {return this;}
376 A3* getA3() {return this;}
379 void test()
381 A1 a1;
382 A2 a2;
383 A3 a3;
384 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
385 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
386 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
387 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA1());
388 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
390 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
391 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
392 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
393 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
394 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
396 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
397 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
398 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
399 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
400 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
403 } // t7
405 namespace t8
408 struct A1
410 char _[43981];
411 virtual ~A1() {}
413 A1* getA1() {return this;}
416 struct A2
418 char _[34981];
419 virtual ~A2() {}
421 A2* getA2() {return this;}
424 struct A3
425 : private A1,
426 public A2
428 char _[93481];
429 virtual ~A3() {}
431 A1* getA1() {return this;}
432 A2* getA2() {return this;}
433 A3* getA3() {return this;}
436 void test()
438 A1 a1;
439 A2 a2;
440 A3 a3;
441 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
442 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
443 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
444 assert(dynamic_cast<A1*>(a3.getA2()) == 0);
446 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
447 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
448 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
449 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
450 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
452 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
453 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
454 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
455 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
456 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
459 } // t8
461 namespace t9
464 struct A1
466 char _[43981];
467 virtual ~A1() {}
469 A1* getA1() {return this;}
472 struct A2
474 char _[34981];
475 virtual ~A2() {}
477 A2* getA2() {return this;}
480 struct A3
481 : private virtual A1,
482 public A2
484 char _[93481];
485 virtual ~A3() {}
487 A1* getA1() {return this;}
488 A2* getA2() {return this;}
489 A3* getA3() {return this;}
492 void test()
494 A1 a1;
495 A2 a2;
496 A3 a3;
497 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
498 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
499 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
500 assert(dynamic_cast<A1*>(a3.getA2()) == 0);
502 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
503 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
504 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
505 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
506 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
508 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
509 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
510 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
511 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
512 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
515 } // t9
517 namespace t10
520 struct A1
522 char _[43981];
523 virtual ~A1() {}
525 A1* getA1() {return this;}
528 struct A2
530 char _[34981];
531 virtual ~A2() {}
533 A2* getA2() {return this;}
536 struct A3
537 : public virtual A1,
538 public virtual A2
540 char _[93481];
541 virtual ~A3() {}
543 A1* getA1() {return this;}
544 A2* getA2() {return this;}
545 A3* getA3() {return this;}
548 void test()
550 A1 a1;
551 A2 a2;
552 A3 a3;
553 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
554 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
555 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
556 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA1());
557 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
559 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
560 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
561 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
562 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
563 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
565 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
566 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
567 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
568 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
569 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
572 } // t10
574 namespace t11
577 struct A1
579 char _[43981];
580 virtual ~A1() {}
582 A1* getA1() {return this;}
585 struct A2
587 char _[34981];
588 virtual ~A2() {}
590 A2* getA2() {return this;}
593 struct A3
594 : private A1,
595 public virtual A2
597 char _[93481];
598 virtual ~A3() {}
600 A1* getA1() {return this;}
601 A2* getA2() {return this;}
602 A3* getA3() {return this;}
605 void test()
607 A1 a1;
608 A2 a2;
609 A3 a3;
610 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
611 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
612 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
613 assert(dynamic_cast<A1*>(a3.getA2()) == 0);
615 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
616 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
617 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
618 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
619 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
621 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
622 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
623 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
624 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
625 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
628 } // t11
630 namespace t12
633 struct A1
635 char _[43981];
636 virtual ~A1() {}
638 A1* getA1() {return this;}
641 struct A2
643 char _[34981];
644 virtual ~A2() {}
646 A2* getA2() {return this;}
649 struct A3
650 : private virtual A1,
651 public virtual A2
653 char _[93481];
654 virtual ~A3() {}
656 A1* getA1() {return this;}
657 A2* getA2() {return this;}
658 A3* getA3() {return this;}
661 void test()
663 A1 a1;
664 A2 a2;
665 A3 a3;
666 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
667 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
668 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
669 assert(dynamic_cast<A1*>(a3.getA2()) == 0);
671 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
672 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
673 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
674 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
675 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
677 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
678 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
679 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
680 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
681 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
684 } // t12
686 namespace t13
689 struct A1
691 char _[43981];
692 virtual ~A1() {}
694 A1* getA1() {return this;}
697 struct A2
699 char _[34981];
700 virtual ~A2() {}
702 A2* getA2() {return this;}
705 struct A3
706 : private A1,
707 private A2
709 char _[93481];
710 virtual ~A3() {}
712 A1* getA1() {return this;}
713 A2* getA2() {return this;}
714 A3* getA3() {return this;}
717 void test()
719 A1 a1;
720 A2 a2;
721 A3 a3;
722 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
723 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
724 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
725 assert(dynamic_cast<A1*>(a3.getA2()) == 0);
727 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
728 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
729 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
730 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
732 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
733 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
734 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
735 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
736 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
739 } // t13
741 namespace t14
744 struct A1
746 char _[43981];
747 virtual ~A1() {}
749 A1* getA1() {return this;}
752 struct A2
754 char _[34981];
755 virtual ~A2() {}
757 A2* getA2() {return this;}
760 struct A3
761 : private virtual A1,
762 private A2
764 char _[93481];
765 virtual ~A3() {}
767 A1* getA1() {return this;}
768 A2* getA2() {return this;}
769 A3* getA3() {return this;}
772 void test()
774 A1 a1;
775 A2 a2;
776 A3 a3;
777 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
778 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
779 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
780 assert(dynamic_cast<A1*>(a3.getA2()) == 0);
782 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
783 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
784 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
785 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
787 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
788 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
789 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
790 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
791 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
794 } // t14
796 namespace t15
799 struct A1
801 char _[43981];
802 virtual ~A1() {}
804 A1* getA1() {return this;}
807 struct A2
809 char _[34981];
810 virtual ~A2() {}
812 A2* getA2() {return this;}
815 struct A3
816 : private virtual A1,
817 private virtual A2
819 char _[93481];
820 virtual ~A3() {}
822 A1* getA1() {return this;}
823 A2* getA2() {return this;}
824 A3* getA3() {return this;}
827 void test()
829 A1 a1;
830 A2 a2;
831 A3 a3;
832 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
833 assert(dynamic_cast<A1*>(a2.getA2()) == 0);
834 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
835 assert(dynamic_cast<A1*>(a3.getA2()) == 0);
837 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
838 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
839 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
840 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
842 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
843 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
844 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
845 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
846 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
849 } // t15
861 namespace t16
864 struct A1
866 char _[43981];
867 virtual ~A1() {}
869 A1* getA1() {return this;}
872 struct A2
873 : public A1
875 char _[34981];
876 virtual ~A2() {}
878 A1* getA1() {return this;}
879 A2* getA2() {return this;}
882 struct A3
883 : public A2
885 char _[93481];
886 virtual ~A3() {}
888 A1* getA1() {return this;}
889 A2* getA2() {return this;}
890 A3* getA3() {return this;}
893 void test()
895 A1 a1;
896 A2 a2;
897 A3 a3;
898 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
899 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
900 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
901 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
902 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA1());
903 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
905 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
906 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
907 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
908 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
909 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
910 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
912 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
913 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
914 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
915 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
916 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
917 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
920 } // t16
922 namespace t17
925 struct A1
927 char _[43981];
928 virtual ~A1() {}
930 A1* getA1() {return this;}
933 struct A2
934 : public virtual A1
936 char _[34981];
937 virtual ~A2() {}
939 A1* getA1() {return this;}
940 A2* getA2() {return this;}
943 struct A3
944 : public A2
946 char _[93481];
947 virtual ~A3() {}
949 A1* getA1() {return this;}
950 A2* getA2() {return this;}
951 A3* getA3() {return this;}
954 void test()
956 A1 a1;
957 A2 a2;
958 A3 a3;
959 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
960 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
961 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
962 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
963 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA1());
964 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
966 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
967 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
968 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
969 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
970 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
971 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
973 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
974 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
975 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
976 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
977 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
978 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
981 } // t17
983 namespace t18
986 struct A1
988 char _[43981];
989 virtual ~A1() {}
991 A1* getA1() {return this;}
994 struct A2
995 : private A1
997 char _[34981];
998 virtual ~A2() {}
1000 A1* getA1() {return this;}
1001 A2* getA2() {return this;}
1004 struct A3
1005 : public A2
1007 char _[93481];
1008 virtual ~A3() {}
1010 A2* getA2() {return this;}
1011 A3* getA3() {return this;}
1014 void test()
1016 A1 a1;
1017 A2 a2;
1018 A3 a3;
1019 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1020 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1021 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
1023 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1024 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1025 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1026 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
1027 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1028 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
1030 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1031 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1032 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1033 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
1034 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
1035 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1038 } // t18
1040 namespace t19
1043 struct A1
1045 char _[43981];
1046 virtual ~A1() {}
1048 A1* getA1() {return this;}
1051 struct A2
1052 : protected virtual A1
1054 char _[34981];
1055 virtual ~A2() {}
1057 A1* getA1() {return this;}
1058 A2* getA2() {return this;}
1061 struct A3
1062 : public A2
1064 char _[93481];
1065 virtual ~A3() {}
1067 A2* getA2() {return this;}
1068 A3* getA3() {return this;}
1071 void test()
1073 A1 a1;
1074 A2 a2;
1075 A3 a3;
1076 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1077 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1078 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
1080 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1081 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1082 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1083 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
1084 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1085 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
1087 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1088 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1089 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1090 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
1091 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
1092 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1095 } // t19
1097 namespace t20
1100 struct A1
1102 char _[43981];
1103 virtual ~A1() {}
1105 A1* getA1() {return this;}
1108 struct A2
1109 : public virtual A1
1111 char _[34981];
1112 virtual ~A2() {}
1114 A1* getA1() {return this;}
1115 A2* getA2() {return this;}
1118 struct A3
1119 : public virtual A2
1121 char _[93481];
1122 virtual ~A3() {}
1124 A1* getA1() {return this;}
1125 A2* getA2() {return this;}
1126 A3* getA3() {return this;}
1129 void test()
1131 A1 a1;
1132 A2 a2;
1133 A3 a3;
1134 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1135 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1136 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
1137 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
1138 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA1());
1139 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
1141 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1142 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
1143 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1144 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
1145 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1146 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
1148 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1149 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1150 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1151 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
1152 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
1153 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1156 } // t20
1158 namespace t21
1161 struct A1
1163 char _[43981];
1164 virtual ~A1() {}
1166 A1* getA1() {return this;}
1169 struct A2
1170 : private A1
1172 char _[34981];
1173 virtual ~A2() {}
1175 A1* getA1() {return this;}
1176 A2* getA2() {return this;}
1179 struct A3
1180 : public virtual A2
1182 char _[93481];
1183 virtual ~A3() {}
1185 A2* getA2() {return this;}
1186 A3* getA3() {return this;}
1189 void test()
1191 A1 a1;
1192 A2 a2;
1193 A3 a3;
1194 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1195 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1196 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
1198 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1199 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1200 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1201 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
1202 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1203 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
1205 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1206 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1207 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1208 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
1209 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
1210 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1213 } // t21
1215 namespace t22
1218 struct A1
1220 char _[43981];
1221 virtual ~A1() {}
1223 A1* getA1() {return this;}
1226 struct A2
1227 : protected virtual A1
1229 char _[34981];
1230 virtual ~A2() {}
1232 A1* getA1() {return this;}
1233 A2* getA2() {return this;}
1236 struct A3
1237 : public virtual A2
1239 char _[93481];
1240 virtual ~A3() {}
1242 A2* getA2() {return this;}
1243 A3* getA3() {return this;}
1246 void test()
1248 A1 a1;
1249 A2 a2;
1250 A3 a3;
1251 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1252 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1253 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
1255 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1256 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1257 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1258 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
1259 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1260 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
1262 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1263 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1264 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1265 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
1266 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
1267 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1270 } // t22
1272 namespace t23
1275 struct A1
1277 char _[43981];
1278 virtual ~A1() {}
1280 A1* getA1() {return this;}
1283 struct A2
1284 : private A1
1286 char _[34981];
1287 virtual ~A2() {}
1289 A1* getA1() {return this;}
1290 A2* getA2() {return this;}
1293 struct A3
1294 : private A2
1296 char _[93481];
1297 virtual ~A3() {}
1299 t23::A1* getA1() {return A2::getA1();}
1300 A2* getA2() {return this;}
1301 A3* getA3() {return this;}
1304 void test()
1306 A1 a1;
1307 A2 a2;
1308 A3 a3;
1309 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1310 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1311 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
1313 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1314 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1315 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1316 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
1317 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1319 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1320 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1321 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1322 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
1323 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
1324 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1327 } // t23
1329 namespace t24
1332 struct A1
1334 char _[43981];
1335 virtual ~A1() {}
1337 A1* getA1() {return this;}
1340 struct A2
1341 : protected virtual A1
1343 char _[34981];
1344 virtual ~A2() {}
1346 A1* getA1() {return this;}
1347 A2* getA2() {return this;}
1350 struct A3
1351 : private A2
1353 char _[93481];
1354 virtual ~A3() {}
1356 t24::A1* getA1() {return A2::getA1();}
1357 A2* getA2() {return this;}
1358 A3* getA3() {return this;}
1361 void test()
1363 A1 a1;
1364 A2 a2;
1365 A3 a3;
1366 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1367 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1368 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
1370 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1371 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1372 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1373 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
1374 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1376 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1377 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1378 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1379 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
1380 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
1381 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1384 } // t24
1386 namespace t25
1389 struct A1
1391 char _[43981];
1392 virtual ~A1() {}
1394 A1* getA1() {return this;}
1397 struct A2
1398 : protected virtual A1
1400 char _[34981];
1401 virtual ~A2() {}
1403 A1* getA1() {return this;}
1404 A2* getA2() {return this;}
1407 struct A3
1408 : private virtual A2
1410 char _[93481];
1411 virtual ~A3() {}
1413 t25::A1* getA1() {return A2::getA1();}
1414 A2* getA2() {return this;}
1415 A3* getA3() {return this;}
1418 void test()
1420 A1 a1;
1421 A2 a2;
1422 A3 a3;
1423 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1424 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1425 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
1427 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1428 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1429 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1430 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
1431 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1433 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1434 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1435 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1436 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
1437 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
1438 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1441 } // t25
1445 A1 A1
1447 A2 |
1453 namespace t26
1456 struct A1
1458 char _[43981];
1459 virtual ~A1() {}
1461 A1* getA1() {return this;}
1464 struct A2
1465 : public A1
1467 char _[34981];
1468 virtual ~A2() {}
1470 A1* getA1() {return this;}
1471 A2* getA2() {return this;}
1474 struct A3
1475 : public A1,
1476 public A2
1478 char _[93481];
1479 virtual ~A3() {}
1481 A1* getA12() {return A2::getA1();}
1482 A2* getA2() {return this;}
1483 A3* getA3() {return this;}
1486 void test()
1488 A1 a1;
1489 A2 a2;
1490 A3 a3;
1491 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1492 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1493 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
1494 assert(dynamic_cast<A1*>(a3.getA12()) == a3.getA12());
1495 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA12());
1497 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1498 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
1499 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1500 assert(dynamic_cast<A2*>(a3.getA12()) == a3.getA2());
1501 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1502 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
1504 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1505 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1506 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1507 assert(dynamic_cast<A3*>(a3.getA12()) == a3.getA3());
1508 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
1509 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1512 } // t26
1514 namespace t27
1517 struct A1
1519 char _[43981];
1520 virtual ~A1() {}
1522 A1* getA1() {return this;}
1525 struct A2
1526 : private A1
1528 char _[34981];
1529 virtual ~A2() {}
1531 A1* getA1() {return this;}
1532 A2* getA2() {return this;}
1535 struct A3
1536 : public A1,
1537 public A2
1539 char _[93481];
1540 virtual ~A3() {}
1542 A1* getA12() {return A2::getA1();}
1543 A2* getA2() {return this;}
1544 A3* getA3() {return this;}
1547 void test()
1549 A1 a1;
1550 A2 a2;
1551 A3 a3;
1552 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1553 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1554 assert(dynamic_cast<A1*>(a3.getA12()) == a3.getA12());
1556 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1557 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1558 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1559 assert(dynamic_cast<A2*>(a3.getA12()) == 0);
1560 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1561 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
1563 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1564 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1565 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1566 assert(dynamic_cast<A3*>(a3.getA12()) == 0);
1567 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
1568 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1571 } // t27
1573 namespace t28
1576 struct A1
1578 char _[43981];
1579 virtual ~A1() {}
1581 A1* getA1() {return this;}
1584 struct A2
1585 : public A1
1587 char _[34981];
1588 virtual ~A2() {}
1590 A1* getA1() {return this;}
1591 A2* getA2() {return this;}
1594 struct A3
1595 : private A1,
1596 public A2
1598 char _[93481];
1599 virtual ~A3() {}
1601 A1* getA12() {return A2::getA1();}
1602 A2* getA2() {return this;}
1603 A3* getA3() {return this;}
1606 void test()
1608 A1 a1;
1609 A2 a2;
1610 A3 a3;
1611 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1612 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1613 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
1614 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA12());
1616 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1617 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
1618 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1619 assert(dynamic_cast<A2*>(a3.getA12()) == a3.getA2());
1620 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1621 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
1623 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1624 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1625 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1626 assert(dynamic_cast<A3*>(a3.getA12()) == a3.getA3());
1627 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
1628 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1631 } // t28
1633 namespace t29
1636 struct A1
1638 char _[43981];
1639 virtual ~A1() {}
1641 A1* getA1() {return this;}
1644 struct A2
1645 : public A1
1647 char _[34981];
1648 virtual ~A2() {}
1650 A1* getA1() {return this;}
1651 A2* getA2() {return this;}
1654 struct A3
1655 : public A1,
1656 private A2
1658 char _[93481];
1659 virtual ~A3() {}
1661 A1* getA12() {return A2::getA1();}
1662 A2* getA2() {return this;}
1663 A3* getA3() {return this;}
1666 void test()
1668 A1 a1;
1669 A2 a2;
1670 A3 a3;
1671 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1672 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1673 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
1674 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA12());
1676 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1677 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
1678 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1679 assert(dynamic_cast<A2*>(a3.getA12()) == a3.getA2());
1680 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1682 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1683 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1684 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1685 assert(dynamic_cast<A3*>(a3.getA12()) == 0);
1686 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
1687 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1690 } // t29
1692 namespace t30
1695 struct A1
1697 char _[43981];
1698 virtual ~A1() {}
1700 A1* getA1() {return this;}
1703 struct A2
1704 : public A1
1706 char _[34981];
1707 virtual ~A2() {}
1709 A1* getA1() {return this;}
1710 A2* getA2() {return this;}
1713 struct A3
1714 : private A1,
1715 private A2
1717 char _[93481];
1718 virtual ~A3() {}
1720 A1* getA12() {return A2::getA1();}
1721 A2* getA2() {return this;}
1722 A3* getA3() {return this;}
1725 void test()
1727 A1 a1;
1728 A2 a2;
1729 A3 a3;
1730 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1731 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1732 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
1733 assert(dynamic_cast<A1*>(a3.getA12()) == a3.getA12());
1734 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA12());
1736 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1737 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
1738 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1739 assert(dynamic_cast<A2*>(a3.getA12()) == a3.getA2());
1740 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1742 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1743 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1744 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1745 assert(dynamic_cast<A3*>(a3.getA12()) == 0);
1746 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
1747 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1750 } // t30
1752 namespace t31
1755 struct A1
1757 char _[43981];
1758 virtual ~A1() {}
1760 A1* getA1() {return this;}
1763 struct A2
1764 : private A1
1766 char _[34981];
1767 virtual ~A2() {}
1769 A1* getA1() {return this;}
1770 A2* getA2() {return this;}
1773 struct A3
1774 : public A1,
1775 private A2
1777 char _[93481];
1778 virtual ~A3() {}
1780 A1* getA12() {return A2::getA1();}
1781 A2* getA2() {return this;}
1782 A3* getA3() {return this;}
1785 void test()
1787 A1 a1;
1788 A2 a2;
1789 A3 a3;
1790 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1791 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1792 assert(dynamic_cast<A1*>(a3.getA12()) == a3.getA12());
1794 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1795 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1796 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1797 assert(dynamic_cast<A2*>(a3.getA12()) == 0);
1798 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1800 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1801 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1802 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1803 assert(dynamic_cast<A3*>(a3.getA12()) == 0);
1804 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
1805 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1808 } // t31
1810 namespace t32
1813 struct A1
1815 char _[43981];
1816 virtual ~A1() {}
1818 A1* getA1() {return this;}
1821 struct A2
1822 : private A1
1824 char _[34981];
1825 virtual ~A2() {}
1827 A1* getA1() {return this;}
1828 A2* getA2() {return this;}
1831 struct A3
1832 : private A1,
1833 public A2
1835 char _[93481];
1836 virtual ~A3() {}
1838 A1* getA12() {return A2::getA1();}
1839 A2* getA2() {return this;}
1840 A3* getA3() {return this;}
1843 void test()
1845 A1 a1;
1846 A2 a2;
1847 A3 a3;
1848 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1849 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1850 assert(dynamic_cast<A1*>(a3.getA12()) == a3.getA12());
1852 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1853 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1854 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1855 assert(dynamic_cast<A2*>(a3.getA12()) == 0);
1856 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1858 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1859 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1860 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1861 assert(dynamic_cast<A3*>(a3.getA12()) == 0);
1862 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
1863 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1866 } // t32
1868 namespace t33
1871 struct A1
1873 char _[43981];
1874 virtual ~A1() {}
1876 A1* getA1() {return this;}
1879 struct A2
1880 : private A1
1882 char _[34981];
1883 virtual ~A2() {}
1885 A1* getA1() {return this;}
1886 A2* getA2() {return this;}
1889 struct A3
1890 : private A1,
1891 private A2
1893 char _[93481];
1894 virtual ~A3() {}
1896 A1* getA12() {return A2::getA1();}
1897 A2* getA2() {return this;}
1898 A3* getA3() {return this;}
1901 void test()
1903 A1 a1;
1904 A2 a2;
1905 A3 a3;
1906 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1907 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1908 assert(dynamic_cast<A1*>(a3.getA12()) == a3.getA12());
1910 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1911 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
1912 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1913 assert(dynamic_cast<A2*>(a3.getA12()) == 0);
1914 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1916 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1917 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1918 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1919 assert(dynamic_cast<A3*>(a3.getA12()) == 0);
1920 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
1921 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1924 } // t33
1930 A2 \
1936 namespace t34
1939 struct A1
1941 char _[43981];
1942 virtual ~A1() {}
1944 A1* getA1() {return this;}
1947 struct A2
1948 : public virtual A1
1950 char _[34981];
1951 virtual ~A2() {}
1953 A1* getA1() {return this;}
1954 A2* getA2() {return this;}
1957 struct A3
1958 : public virtual A1,
1959 public A2
1961 char _[93481];
1962 virtual ~A3() {}
1964 A1* getA1() {return A1::getA1();}
1965 A2* getA2() {return this;}
1966 A3* getA3() {return this;}
1969 void test()
1971 A1 a1;
1972 A2 a2;
1973 A3 a3;
1974 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
1975 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
1976 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
1977 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
1978 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA1());
1979 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
1981 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
1982 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
1983 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
1984 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
1985 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
1986 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
1988 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
1989 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
1990 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
1991 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
1992 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
1993 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
1996 } // t34
1998 namespace t35
2001 struct A1
2003 char _[43981];
2004 virtual ~A1() {}
2006 A1* getA1() {return this;}
2009 struct A2
2010 : private virtual A1
2012 char _[34981];
2013 virtual ~A2() {}
2015 A1* getA1() {return this;}
2016 A2* getA2() {return this;}
2019 struct A3
2020 : public virtual A1,
2021 public A2
2023 char _[93481];
2024 virtual ~A3() {}
2026 A1* getA1() {return A1::getA1();}
2027 A2* getA2() {return this;}
2028 A3* getA3() {return this;}
2031 void test()
2033 A1 a1;
2034 A2 a2;
2035 A3 a3;
2036 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
2037 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
2038 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
2039 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
2041 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
2042 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
2043 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
2044 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
2045 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
2046 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
2048 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
2049 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
2050 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
2051 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
2052 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
2053 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
2056 } // t35
2058 namespace t36
2061 struct A1
2063 char _[43981];
2064 virtual ~A1() {}
2066 A1* getA1() {return this;}
2069 struct A2
2070 : public virtual A1
2072 char _[34981];
2073 virtual ~A2() {}
2075 A1* getA1() {return this;}
2076 A2* getA2() {return this;}
2079 struct A3
2080 : private virtual A1,
2081 public A2
2083 char _[93481];
2084 virtual ~A3() {}
2086 A1* getA1() {return A1::getA1();}
2087 A2* getA2() {return this;}
2088 A3* getA3() {return this;}
2091 void test()
2093 A1 a1;
2094 A2 a2;
2095 A3 a3;
2096 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
2097 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
2098 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
2099 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
2100 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA1());
2101 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
2103 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
2104 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
2105 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
2106 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
2107 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
2108 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
2110 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
2111 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
2112 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
2113 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
2114 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
2115 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
2118 } // t36
2120 namespace t37
2123 struct A1
2125 char _[43981];
2126 virtual ~A1() {}
2128 A1* getA1() {return this;}
2131 struct A2
2132 : public virtual A1
2134 char _[34981];
2135 virtual ~A2() {}
2137 A1* getA1() {return this;}
2138 A2* getA2() {return this;}
2141 struct A3
2142 : public virtual A1,
2143 private A2
2145 char _[93481];
2146 virtual ~A3() {}
2148 A1* getA1() {return A1::getA1();}
2149 A2* getA2() {return this;}
2150 A3* getA3() {return this;}
2153 void test()
2155 A1 a1;
2156 A2 a2;
2157 A3 a3;
2158 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
2159 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
2160 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
2161 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
2162 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA1());
2163 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
2165 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
2166 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
2167 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
2168 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
2169 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
2171 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
2172 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
2173 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
2174 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
2175 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
2176 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
2179 } // t37
2181 namespace t38
2184 struct A1
2186 char _[43981];
2187 virtual ~A1() {}
2189 A1* getA1() {return this;}
2192 struct A2
2193 : public virtual A1
2195 char _[34981];
2196 virtual ~A2() {}
2198 A1* getA1() {return this;}
2199 A2* getA2() {return this;}
2202 struct A3
2203 : private virtual A1,
2204 private A2
2206 char _[93481];
2207 virtual ~A3() {}
2209 A1* getA1() {return A1::getA1();}
2210 A2* getA2() {return this;}
2211 A3* getA3() {return this;}
2214 void test()
2216 A1 a1;
2217 A2 a2;
2218 A3 a3;
2219 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
2220 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
2221 assert(dynamic_cast<A1*>(a2.getA2()) == a2.getA1());
2222 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
2223 assert(dynamic_cast<A1*>(a3.getA2()) == a3.getA1());
2225 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
2226 assert(dynamic_cast<A2*>(a2.getA1()) == a2.getA2());
2227 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
2228 assert(dynamic_cast<A2*>(a3.getA1()) == a3.getA2());
2229 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
2231 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
2232 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
2233 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
2234 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
2235 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
2236 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
2239 } // t38
2241 namespace t39
2244 struct A1
2246 char _[43981];
2247 virtual ~A1() {}
2249 A1* getA1() {return this;}
2252 struct A2
2253 : private virtual A1
2255 char _[34981];
2256 virtual ~A2() {}
2258 A1* getA1() {return this;}
2259 A2* getA2() {return this;}
2262 struct A3
2263 : public virtual A1,
2264 private A2
2266 char _[93481];
2267 virtual ~A3() {}
2269 A1* getA1() {return A1::getA1();}
2270 A2* getA2() {return this;}
2271 A3* getA3() {return this;}
2274 void test()
2276 A1 a1;
2277 A2 a2;
2278 A3 a3;
2279 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
2280 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
2281 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
2282 assert(dynamic_cast<A1*>(a3.getA3()) == a3.getA1());
2284 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
2285 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
2286 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
2287 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
2288 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
2290 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
2291 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
2292 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
2293 assert(dynamic_cast<A3*>(a3.getA1()) == a3.getA3());
2294 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
2295 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
2298 } // t39
2300 namespace t40
2303 struct A1
2305 char _[43981];
2306 virtual ~A1() {}
2308 A1* getA1() {return this;}
2311 struct A2
2312 : private virtual A1
2314 char _[34981];
2315 virtual ~A2() {}
2317 A1* getA1() {return this;}
2318 A2* getA2() {return this;}
2321 struct A3
2322 : private virtual A1,
2323 public A2
2325 char _[93481];
2326 virtual ~A3() {}
2328 A1* getA1() {return A1::getA1();}
2329 A2* getA2() {return this;}
2330 A3* getA3() {return this;}
2333 void test()
2335 A1 a1;
2336 A2 a2;
2337 A3 a3;
2338 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
2339 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
2340 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
2342 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
2343 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
2344 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
2345 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
2346 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
2347 assert(dynamic_cast<A2*>(a3.getA3()) == a3.getA2());
2349 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
2350 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
2351 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
2352 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
2353 assert(dynamic_cast<A3*>(a3.getA2()) == a3.getA3());
2354 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
2357 } // t40
2359 namespace t41
2362 struct A1
2364 char _[43981];
2365 virtual ~A1() {}
2367 A1* getA1() {return this;}
2370 struct A2
2371 : private virtual A1
2373 char _[34981];
2374 virtual ~A2() {}
2376 A1* getA1() {return this;}
2377 A2* getA2() {return this;}
2380 struct A3
2381 : private virtual A1,
2382 private A2
2384 char _[93481];
2385 virtual ~A3() {}
2387 A1* getA1() {return A1::getA1();}
2388 A2* getA2() {return this;}
2389 A3* getA3() {return this;}
2392 void test()
2394 A1 a1;
2395 A2 a2;
2396 A3 a3;
2397 assert(dynamic_cast<A1*>(a1.getA1()) == a1.getA1());
2398 assert(dynamic_cast<A1*>(a2.getA1()) == a2.getA1());
2399 assert(dynamic_cast<A1*>(a3.getA1()) == a3.getA1());
2401 assert(dynamic_cast<A2*>(a1.getA1()) == 0);
2402 assert(dynamic_cast<A2*>(a2.getA1()) == 0);
2403 assert(dynamic_cast<A2*>(a2.getA2()) == a2.getA2());
2404 assert(dynamic_cast<A2*>(a3.getA1()) == 0);
2405 assert(dynamic_cast<A2*>(a3.getA2()) == a3.getA2());
2407 assert(dynamic_cast<A3*>(a1.getA1()) == 0);
2408 assert(dynamic_cast<A3*>(a2.getA1()) == 0);
2409 assert(dynamic_cast<A3*>(a2.getA2()) == 0);
2410 assert(dynamic_cast<A3*>(a3.getA1()) == 0);
2411 assert(dynamic_cast<A3*>(a3.getA2()) == 0);
2412 assert(dynamic_cast<A3*>(a3.getA3()) == a3.getA3());
2415 } // t41
2417 int main(int, char**)
2419 timer t;
2420 t1::test();
2421 t2::test();
2422 t3::test();
2423 t4::test();
2424 t5::test();
2425 t6::test();
2426 t7::test();
2427 t8::test();
2428 t9::test();
2429 t10::test();
2430 t11::test();
2431 t12::test();
2432 t13::test();
2433 t14::test();
2434 t15::test();
2435 t16::test();
2436 t17::test();
2437 t18::test();
2438 t19::test();
2439 t20::test();
2440 t21::test();
2441 t22::test();
2442 t23::test();
2443 t24::test();
2444 t25::test();
2445 t26::test();
2446 t27::test();
2447 t28::test();
2448 t29::test();
2449 t30::test();
2450 t31::test();
2451 t32::test();
2452 t33::test();
2453 t34::test();
2454 t35::test();
2455 t36::test();
2456 t37::test();
2457 t38::test();
2458 t39::test();
2459 t40::test();
2460 t41::test();
2462 return 0;