[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / libcxxabi / test / catch_in_noexcept.pass.cpp
blob6955f1019f4b0342d00debea5dfaed504e41a9bc
1 //===---------------------- catch_in_noexcept.cpp--------------------------===//
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: c++03
10 // UNSUPPORTED: no-exceptions
12 #include <exception>
13 #include <stdlib.h>
14 #include <assert.h>
16 struct A {};
18 // Despite being marked as noexcept, this function must have an EHT entry that
19 // is not 'cantunwind', so that the unwinder can correctly deal with the throw.
20 void f1() noexcept
22 try {
23 A a;
24 throw a;
25 assert(false);
26 } catch (...) {
27 assert(true);
28 return;
30 assert(false);
33 int main(int, char**)
35 f1();
37 return 0;