150
|
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 //===----------------------------------------------------------------------===//
|
|
8
|
|
9 // UNSUPPORTED: c++98, c++03, libcxxabi-no-exceptions
|
|
10
|
|
11 #include <exception>
|
|
12 #include <stdlib.h>
|
|
13 #include <assert.h>
|
|
14
|
|
15 struct A {};
|
|
16
|
|
17 // Despite being marked as noexcept, this function must have an EHT entry that
|
|
18 // is not 'cantunwind', so that the unwinder can correctly deal with the throw.
|
|
19 void f1() noexcept
|
|
20 {
|
|
21 try {
|
|
22 A a;
|
|
23 throw a;
|
|
24 assert(false);
|
|
25 } catch (...) {
|
|
26 assert(true);
|
|
27 return;
|
|
28 }
|
|
29 assert(false);
|
|
30 }
|
|
31
|
|
32 int main()
|
|
33 {
|
|
34 f1();
|
|
35 }
|