]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/libcxx/debug/debug_throw_register.pass.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / libcxx / debug / debug_throw_register.pass.cpp
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: libcpp-no-exceptions
11
12 // Test that defining _LIBCPP_DEBUG_USE_EXCEPTIONS causes _LIBCPP_ASSERT
13 // to throw on failure.
14
15 #define _LIBCPP_DEBUG 1
16 #define _LIBCPP_DEBUG_USE_EXCEPTIONS
17
18 #include <cstdlib>
19 #include <exception>
20 #include <type_traits>
21 #include <__debug>
22 #include <cassert>
23
24 int main()
25 {
26   try {
27     _LIBCPP_ASSERT(false, "foo");
28     assert(false);
29   } catch (...) {}
30 }