1 /* Test if the compiler has working try / throw / catch.
2
3 Copyright 2013 Free Software Foundation, Inc.
4
5 This file is part of the GNU MP Library test suite.
6
7 The GNU MP Library test suite is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 3 of the License,
10 or (at your option) any later version.
11
12 The GNU MP Library test suite is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15 Public License for more details.
16
17 You should have received a copy of the GNU General Public License along with
18 the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
19
20 #include <stdexcept>
21
22 inline void
throw_expr()23 throw_expr ()
24 {
25 throw std::invalid_argument ("Test");
26 }
27
28 using namespace std;
29
30 int
main()31 main ()
32 {
33 try
34 {
35 throw_expr();
36 }
37 catch (invalid_argument&) { }
38 }
39