1 //===---------------------- catch_in_noexcept.cpp--------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include <exception>
11 #include <stdlib.h>
12 #include <assert.h>
13 
14 struct A {};
15 
16 // Despite being marked as noexcept, this function must have an EHT entry that
17 // is not 'cantunwind', so that the unwinder can correctly deal with the throw.
f1()18 void f1() noexcept
19 {
20     try {
21         A a;
22         throw a;
23         assert(false);
24     } catch (...) {
25         assert(true);
26         return;
27     }
28     assert(false);
29 }
30 
main()31 int main()
32 {
33     f1();
34 }
35