diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2013-03-17 14:08:15 +0100 |
---|---|---|
committer | Marc Glisse <marc.glisse@inria.fr> | 2013-03-17 14:08:15 +0100 |
commit | e65e269e6690173741b66ff64d0918fb88799319 (patch) | |
tree | 26c3c83b0c2705e8defcacaf550e00dfa2d60880 /tests/cxx | |
parent | 10ce0a3fe47eb15177546bbd36e1fc7fd6867c34 (diff) | |
download | gmp-e65e269e6690173741b66ff64d0918fb88799319.tar.gz |
New testcase to clearly identify C++ compilers that have a broken exception support.
Diffstat (limited to 'tests/cxx')
-rw-r--r-- | tests/cxx/Makefile.am | 8 | ||||
-rw-r--r-- | tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc | 38 |
2 files changed, 44 insertions, 2 deletions
diff --git a/tests/cxx/Makefile.am b/tests/cxx/Makefile.am index b888d65a4..dfcb1ea34 100644 --- a/tests/cxx/Makefile.am +++ b/tests/cxx/Makefile.am @@ -32,10 +32,12 @@ LDADD = -L$(top_builddir)/.libs \ -lm if WANT_CXX -check_PROGRAMS = t-assign t-binary t-cast t-constr t-cxx11 \ +check_PROGRAMS = t-binary t-cast t-cxx11 \ t-headers t-iostream t-istream t-locale t-misc t-mix \ t-ops t-ops2 t-ops3 t-ostream t-prec \ - t-rand t-ternary t-unary + t-ternary t-unary \ + t-do-exceptions-work-at-all-with-this-compiler \ + t-assign t-constr t-rand TESTS = $(check_PROGRAMS) endif @@ -58,6 +60,8 @@ t_prec_SOURCES = t-prec.cc t_rand_SOURCES = t-rand.cc t_ternary_SOURCES = t-ternary.cc t_unary_SOURCES = t-unary.cc +t_do_exceptions_work_at_all_with_this_compiler_SOURCES = \ + t-do-exceptions-work-at-all-with-this-compiler.cc $(top_builddir)/tests/libtests.la: cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la diff --git a/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc b/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc new file mode 100644 index 000000000..7244c320d --- /dev/null +++ b/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc @@ -0,0 +1,38 @@ +/* Test if the compiler has working try / throw / catch. + +Copyright 2013 Free Software Foundation, Inc. + +This file is part of the GNU MP Library test suite. + +The GNU MP Library test suite is free software; you can redistribute it +and/or modify it under the terms of the GNU General Public License as +published by the Free Software Foundation; either version 3 of the License, +or (at your option) any later version. + +The GNU MP Library test suite is distributed in the hope that it will be +useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +Public License for more details. + +You should have received a copy of the GNU General Public License along with +the GNU MP Library test suite. If not, see http://www.gnu.org/licenses/. */ + +#include <stdexcept> + +inline void +throw_expr () +{ + throw std::invalid_argument ("Test"); +} + +using namespace std; + +int +main () +{ + try + { + throw_expr(); + } + catch (invalid_argument) { } +} |