New test case.

From-SVN: r31432
This commit is contained in:
Martin v. Löwis 2000-01-14 23:43:19 +00:00
parent 64f1326a88
commit f2aabbd80d

View File

@ -0,0 +1,33 @@
// Test whether N::operator new is different from ::operator new
#include <new>
#include <cstdlib>
bool success;
namespace N{
void* operator new(size_t n){
success = true;
return std::malloc(n);
}
}
void *operator new(size_t n)throw(std::bad_alloc)
{
static bool entered = false;
if(entered)
throw std::bad_alloc();
entered = true;
void *result = N::operator new(n);
entered = false;
return result;
}
int main()
{
try{
new int;
}catch(...){
return 1;
}
return success?0:1;
}