URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 305 |
Rev 338 |
// { dg-do run }
|
// { dg-do run }
|
// Author: Alfred Miniarik
|
// Author: Alfred Miniarik
|
// test of dynamic_cast
|
// test of dynamic_cast
|
// runtime detecting of nonpublic
|
// runtime detecting of nonpublic
|
// inheritance within a cast
|
// inheritance within a cast
|
// and therefor failing with result 0.
|
// and therefor failing with result 0.
|
|
|
extern "C" void abort();
|
extern "C" void abort();
|
extern "C" int printf (const char *, ...);
|
extern "C" int printf (const char *, ...);
|
|
|
static int errors = 0;
|
static int errors = 0;
|
|
|
void error(int i)
|
void error(int i)
|
{
|
{
|
printf("Error %i\n",i);
|
printf("Error %i\n",i);
|
errors++;
|
errors++;
|
}
|
}
|
|
|
struct A {virtual ~A(){}};
|
struct A {virtual ~A(){}};
|
struct B : private virtual A {};
|
struct B : private virtual A {};
|
struct C : virtual A {};
|
struct C : virtual A {};
|
struct D : B, C {};
|
struct D : B, C {};
|
|
|
int
|
int
|
main()
|
main()
|
{
|
{
|
D d;
|
D d;
|
A* ap= &d;
|
A* ap= &d;
|
if(&d != dynamic_cast(ap)) error(1);
|
if(&d != dynamic_cast(ap)) error(1);
|
if((B*)&d != dynamic_cast(ap)) error(2);
|
if((B*)&d != dynamic_cast(ap)) error(2);
|
if((C*)&d != dynamic_cast(ap)) error(3);
|
if((C*)&d != dynamic_cast(ap)) error(3);
|
return errors ? 1 : 0;
|
return errors ? 1 : 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.