1
//===----------------------------------------------------------------------===//
3
// The LLVM Compiler Infrastructure
5
// This file is dual licensed under the MIT and the University of Illinois Open
6
// Source Licenses. See LICENSE.TXT for details.
8
//===----------------------------------------------------------------------===//
10
// test operator new nothrow by replacing only operator new
20
void* operator new(std::size_t s) throw(std::bad_alloc)
23
return std::malloc(s);
26
void operator delete(void* p) throw()
32
bool A_constructed = false;
36
A() {A_constructed = true;}
37
~A() {A_constructed = false;}
42
A* ap = new (std::nothrow) A;
44
assert(A_constructed);
47
assert(!A_constructed);