URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 305 |
Rev 338 |
// { dg-do run }
|
// { dg-do run }
|
// prms-id: 5571
|
// prms-id: 5571
|
|
|
int e = 0;
|
int e = 0;
|
void *vp = 0;
|
void *vp = 0;
|
|
|
class ParentOne {
|
class ParentOne {
|
public:
|
public:
|
ParentOne() {}
|
ParentOne() {}
|
#ifdef MAKE_WORK
|
#ifdef MAKE_WORK
|
virtual ~ParentOne() {}
|
virtual ~ParentOne() {}
|
#endif
|
#endif
|
private:
|
private:
|
char SomeData[101];
|
char SomeData[101];
|
};
|
};
|
|
|
class ParentTwo {
|
class ParentTwo {
|
public:
|
public:
|
ParentTwo() {}
|
ParentTwo() {}
|
virtual ~ParentTwo() {}
|
virtual ~ParentTwo() {}
|
private:
|
private:
|
int MoreData[12];
|
int MoreData[12];
|
virtual int foo() { return 0; }
|
virtual int foo() { return 0; }
|
};
|
};
|
|
|
struct Child : public ParentOne, public ParentTwo {
|
struct Child : public ParentOne, public ParentTwo {
|
int ChildsToy;
|
int ChildsToy;
|
virtual void PrintThis() = 0;
|
virtual void PrintThis() = 0;
|
};
|
};
|
|
|
struct Student : public Child {
|
struct Student : public Child {
|
int StudentsBook;
|
int StudentsBook;
|
void PrintThis() {
|
void PrintThis() {
|
if (vp == 0)
|
if (vp == 0)
|
vp = (void *)this;
|
vp = (void *)this;
|
else
|
else
|
{
|
{
|
if (vp != (void *)this)
|
if (vp != (void *)this)
|
++e;
|
++e;
|
}
|
}
|
}
|
}
|
void LocalPrintThis() {
|
void LocalPrintThis() {
|
if (vp == 0)
|
if (vp == 0)
|
vp = (void *)this;
|
vp = (void *)this;
|
else
|
else
|
{
|
{
|
if (vp != (void *)this)
|
if (vp != (void *)this)
|
++e;
|
++e;
|
}
|
}
|
PrintThis();
|
PrintThis();
|
}
|
}
|
void ForcedPrintThis() {
|
void ForcedPrintThis() {
|
if (vp == 0)
|
if (vp == 0)
|
vp = (void *)this;
|
vp = (void *)this;
|
else
|
else
|
{
|
{
|
if (vp != (void *)this)
|
if (vp != (void *)this)
|
++e;
|
++e;
|
}
|
}
|
Student::PrintThis();
|
Student::PrintThis();
|
}
|
}
|
};
|
};
|
|
|
int main() {
|
int main() {
|
Student o;
|
Student o;
|
o.LocalPrintThis();
|
o.LocalPrintThis();
|
o.ForcedPrintThis();
|
o.ForcedPrintThis();
|
Child* pX = &o;
|
Child* pX = &o;
|
pX->PrintThis();
|
pX->PrintThis();
|
return e;
|
return e;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.