URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [delete8.C] - Rev 149
Go to most recent revision | Compare with Previous | Blame | View Log
// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
#include <stdlib.h>
struct S {
~S ();
};
bool flag;
S* s1;
S* s2;
void* operator new (size_t s)
{
return malloc (s);
}
void operator delete (void* p)
{
if (flag && p != s2)
abort ();
}
S::~S () {
if (this != s2)
abort ();
s1 = 0;
}
int main () {
s2 = new S;
s1 = s2;
// Turn on the check in `operator delete'.
flag = true;
delete s1;
// Turn it off again so that normal shutdown code works.
flag = false;
}
Go to most recent revision | Compare with Previous | Blame | View Log