Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / language.support / support.exception / uncaught / uncaught_exception.pass.cpp
blob6fa4cb22070c8e436cdbc0716520637ccbdd0565
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-exceptions
11 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION
12 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
14 // test uncaught_exception
16 #include <exception>
17 #include <cassert>
19 #include "test_macros.h"
21 struct A
23 ~A()
25 assert(std::uncaught_exception());
29 struct B
31 B()
33 // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#475
34 assert(!std::uncaught_exception());
38 int main(int, char**)
40 try
42 A a;
43 assert(!std::uncaught_exception());
44 throw B();
46 catch (...)
48 assert(!std::uncaught_exception());
50 assert(!std::uncaught_exception());
52 return 0;