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