2 //===----------------------------------------------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 // UNSUPPORTED: libcpp-no-exceptions
12 // MODULES_DEFINES: _LIBCPP_DEBUG=0
14 // Can't test the system lib because this test enables debug mode
15 // UNSUPPORTED: with_system_cxx_lib
17 // Test that the default debug handler can be overridden and test the
18 // throwing debug handler.
20 #define _LIBCPP_DEBUG 0
24 #include <type_traits>
30 std::__libcpp_debug_function = std::__libcpp_throw_debug_function;
32 _LIBCPP_ASSERT(false, "foo");
33 } catch (std::__libcpp_debug_exception const&) {}
36 // test that the libc++ exception type derives from std::exception
37 static_assert((std::is_base_of<std::exception,
38 std::__libcpp_debug_exception
39 >::value), "must be an exception");