URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.mike/] [p4736b.C] - Rev 414
Go to most recent revision | Compare with Previous | Blame | View Log
// { dg-do run }
// prms-id: 4736
class Rep {
public:
virtual int foo() { return 1; }
};
class Rep_1 : public Rep {
};
class VBaseMain {
public:
virtual int foo() { return 2; }
};
class OtherVBase {
public:
virtual int foo() { return 3; }
};
class Rep_2 : public Rep {
};
class DVBase : public VBaseMain, public Rep_2, public OtherVBase {
public:
virtual int foo() { return 4; }
};
class Main : public Rep_1, virtual public DVBase {
public:
virtual int foo() { return 5; }
};
int main() {
Main m;
if (m.foo() != 5)
return 1;
if (((Rep*)(Rep_1*)&m)->foo() != 5)
return 2;
if (((DVBase*)&m)->foo() != 5)
return 3;
if (((VBaseMain*)(DVBase*)&m)->foo() != 5)
return 4;
if (((Rep*)(Rep_2*)(DVBase*)&m)->foo() != 5)
return 5;
if (((OtherVBase*)(DVBase*)&m)->foo() != 5)
return 6;
}
Go to most recent revision | Compare with Previous | Blame | View Log