Fix typo in test case
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / dyncast5.C
bloba6992d76247abea05533edb27cc853d41d83371f
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)
21   A *ad1;
22   A *ad2;
23   
24   ad1 = dynamic_cast<A *>(bd1);
25   if(ad1) abort();
26   ad2 = dynamic_cast<A *>(bd2);
27   if(ad2) abort();
30 int main()
32   D1 d1;
33   D2 d2;
34   
35   fn((B *)&d1, (B *)&d2);
36   return 0;