Jonathan Roelofs | 13584a6 | 2014-05-31 00:25:59 +0000 | [diff] [blame] | 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 | |
Asiri Rathnayake | 4174e8b | 2016-05-31 12:01:32 +0000 | [diff] [blame] | 10 | // UNSUPPORTED: c++98, c++03, libcxxabi-no-exceptions |
Eric Fiselier | b16496b | 2015-08-20 01:22:17 +0000 | [diff] [blame] | 11 | |
Jonathan Roelofs | 13584a6 | 2014-05-31 00:25:59 +0000 | [diff] [blame] | 12 | #include <exception> |
| 13 | #include <stdlib.h> |
| 14 | #include <assert.h> |
| 15 | |
| 16 | struct A {}; |
| 17 | |
| 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 |
| 21 | { |
| 22 | try { |
| 23 | A a; |
| 24 | throw a; |
| 25 | assert(false); |
| 26 | } catch (...) { |
| 27 | assert(true); |
| 28 | return; |
| 29 | } |
| 30 | assert(false); |
| 31 | } |
| 32 | |
| 33 | int main() |
| 34 | { |
| 35 | f1(); |
| 36 | } |