URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [virtual4.C] - Rev 384
Compare with Previous | Blame | View Log
// { dg-do run }
// GROUPS passed virtual-functions
#include <stdio.h>
#include <stdlib.h>
int aset = 0;
class A
{
public:
void Set() { SetProp(); }
virtual void SetProp() { aset++;}
};
class B:public A
{
public:
void SetProp() { if (!aset) { printf ("FAIL\n"); exit (1);} aset--;}
};
int main()
{
A a;
B b;
A *c=new A;
A *d=new B;
a.Set();
b.Set();
c->Set();
d->Set();
printf ("PASS\n");
}