URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 301 |
Rev 384 |
// PR c++/15097
|
// PR c++/15097
|
// { dg-do run }
|
// { dg-do run }
|
|
|
typedef __SIZE_TYPE__ size_t;
|
typedef __SIZE_TYPE__ size_t;
|
|
|
extern "C" void * malloc (size_t);
|
extern "C" void * malloc (size_t);
|
extern "C" void free (void *);
|
extern "C" void free (void *);
|
extern "C" void abort(void);
|
extern "C" void abort(void);
|
|
|
void *saved;
|
void *saved;
|
|
|
void * operator new (size_t size)
|
void * operator new (size_t size)
|
{
|
{
|
void *p = malloc (size);
|
void *p = malloc (size);
|
saved = p;
|
saved = p;
|
return p;
|
return p;
|
}
|
}
|
|
|
void operator delete (void *p)
|
void operator delete (void *p)
|
{
|
{
|
if (p != saved)
|
if (p != saved)
|
abort ();
|
abort ();
|
free (p);
|
free (p);
|
}
|
}
|
|
|
struct B1
|
struct B1
|
{
|
{
|
virtual ~B1 () throw() {}
|
virtual ~B1 () throw() {}
|
B1 (){}
|
B1 (){}
|
int x;
|
int x;
|
};
|
};
|
struct B2
|
struct B2
|
{
|
{
|
virtual ~B2 () throw() {}
|
virtual ~B2 () throw() {}
|
B2 (){}
|
B2 (){}
|
int x;
|
int x;
|
};
|
};
|
struct D : B1, B2
|
struct D : B1, B2
|
{
|
{
|
D (){}
|
D (){}
|
~D () throw() {}
|
~D () throw() {}
|
int y;
|
int y;
|
};
|
};
|
void f1 (D*);
|
void f1 (D*);
|
void f2 (B2*);
|
void f2 (B2*);
|
void f3 (B1*);
|
void f3 (B1*);
|
int main (void)
|
int main (void)
|
{
|
{
|
f1 (::new D);
|
f1 (::new D);
|
f2 (::new D);
|
f2 (::new D);
|
f3 (::new D);
|
f3 (::new D);
|
}
|
}
|
void f1 ( D* p) { ::delete p; }
|
void f1 ( D* p) { ::delete p; }
|
void f2 (B2* p) { ::delete p; }
|
void f2 (B2* p) { ::delete p; }
|
void f3 (B1* p) { ::delete p; }
|
void f3 (B1* p) { ::delete p; }
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.