1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // Make sure that we can enable assertions when we back-deploy to older platforms
10 // if we define _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED.
11 //
12 // Note that this test isn't really different from customize_handler.pass.cpp when
13 // run outside of back-deployment scenarios, but we still run it all the time.
14 
15 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED
16 
17 #include <cassert>
18 
19 bool handler_called = false;
20 void std::__libcpp_verbose_abort(char const*, ...) {
21   handler_called = true;
22 }
23 
24 int main(int, char**) {
25   _LIBCPP_ASSERT(false, "message");
26   assert(handler_called);
27   return 0;
28 }
29