1 // Copyright (C) 1999 Free Software Foundation, Inc.
2 // Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
4 // dynamic cast can only cast to public unambiguous bases
6 extern "C" void abort ();
8 struct A {virtual ~A(){} int m; };
9 struct B {virtual ~B(){} int m; };
11 struct C1 : A {int m;};
12 struct C2 : A {int m;};
14 // A is ambiguous, but private in one branch
15 struct D1 : B, C1, private C2 {int m;};
16 // A is ambiguous, and public in both branches
17 struct D2 : B, C1, C2 {int m;};
19 void fn(B *bd1, B *bd2)
24 ad1 = dynamic_cast<A *>(bd1);
26 ad2 = dynamic_cast<A *>(bd2);
35 fn((B *)&d1, (B *)&d2);