2 // Author: Alfred Miniarik <a8601248@unet.univie.ac.at>
3 // test of dynamic_cast
4 // runtime detecting of nonpublic
5 // inheritance within a cast
6 // and therefor failing with result 0.
8 extern "C" void abort();
9 extern "C" int printf (const char *, ...);
11 static int errors = 0;
15 printf("Error %i\n",i);
19 struct A {virtual ~A(){}};
20 struct B : private virtual A {};
21 struct C : virtual A {};
29 if(&d != dynamic_cast<D*>(ap)) error(1);
30 if((B*)&d != dynamic_cast<B*>(ap)) error(2);
31 if((C*)&d != dynamic_cast<C*>(ap)) error(3);
32 return errors ? 1 : 0;