blob: ed278f9f8d85933a99f71ee372d80cf10d46de35 [file] [log] [blame]
/* { dg-do run } */
#include <stdlib.h>
#include <assert.h>
static bool flag = false;
class C
{
bool prev;
public:
C() : prev(flag)
{
flag = true;
}
~C() {
flag = prev;
}
};
void* operator new(size_t size)
{
assert(flag);
return malloc(size);
}
void operator delete(void *p)
{
free(p);
}
void g(int* p)
{
delete p;
}
void f()
{
int* p;
{
C c;
p = new int;
}
g(p);
}
int main(int, char**)
{
f();
}