| //===----------------------------------------------------------------------===// |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| //===----------------------------------------------------------------------===// |
| // NOTE: asan and msan will not call the new handler. |
| // UNSUPPORTED: sanitizer-new-delete |
| int new_handler_called = 0; |
| #ifndef TEST_HAS_NO_EXCEPTIONS |
| std::set_new_handler(my_new_handler); |
| void* vp = operator new[] (std::numeric_limits<std::size_t>::max()); |
| assert(new_handler_called == 1); |
| assert(A_constructed == 3); |
| assert(A_constructed == 0); |