]>
Commit | Line | Data |
---|---|---|
a5544970 | 1 | // Copyright (C) 2004-2019 Free Software Foundation, Inc. |
c3f0f556 PC |
2 | // |
3 | // This file is part of the GNU ISO C++ Library. This library is free | |
4 | // software; you can redistribute it and/or modify it under the | |
5 | // terms of the GNU General Public License as published by the | |
748086b7 | 6 | // Free Software Foundation; either version 3, or (at your option) |
c3f0f556 PC |
7 | // any later version. |
8 | ||
9 | // This library is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | ||
14 | // You should have received a copy of the GNU General Public License along | |
748086b7 JJ |
15 | // with this library; see the file COPYING3. If not see |
16 | // <http://www.gnu.org/licenses/>. | |
c3f0f556 | 17 | |
5e984b90 BK |
18 | // PR 14026 |
19 | // 18.6.4 uncaught_exception | |
20 | ||
95ed529d JW |
21 | // { dg-options "-Wno-deprecated" } |
22 | ||
5e984b90 | 23 | #include <cstdlib> |
c3f0f556 | 24 | #include <exception> |
c3f0f556 PC |
25 | #include <testsuite_hooks.h> |
26 | ||
5e984b90 BK |
27 | static void |
28 | no_uncaught () | |
c3f0f556 | 29 | { |
5e984b90 BK |
30 | if (std::uncaught_exception()) |
31 | abort(); | |
c3f0f556 PC |
32 | } |
33 | ||
5e984b90 BK |
34 | int |
35 | main() | |
c3f0f556 | 36 | { |
5e984b90 BK |
37 | try |
38 | { | |
39 | throw 1; | |
40 | } | |
41 | catch (...) | |
42 | { | |
43 | try | |
44 | { | |
45 | throw; | |
46 | } | |
47 | catch (...) | |
48 | { | |
49 | no_uncaught (); | |
50 | } | |
51 | } | |
52 | no_uncaught(); | |
53 | ||
c3f0f556 PC |
54 | return 0; |
55 | } |