summaryrefslogtreecommitdiffstats
path: root/libcxx/test/support
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/support')
-rw-r--r--libcxx/test/support/test_throw.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/libcxx/test/support/test_throw.h b/libcxx/test/support/test_throw.h
new file mode 100644
index 00000000000..805cb049de8
--- /dev/null
+++ b/libcxx/test/support/test_throw.h
@@ -0,0 +1,27 @@
+// -*- C++ -*-
+//===---------------------------- test_macros.h ---------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUPPORT_TEST_THROW_H
+#define SUPPORT_TEST_THROW_H
+
+#include "test_macros.h"
+#include <cstdlib>
+
+template <class Ex>
+TEST_NORETURN
+inline void test_throw() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw Ex();
+#else
+ std::abort();
+#endif
+}
+
+#endif // SUPPORT_TEST_THROW_H
OpenPOWER on IntegriCloud