summaryrefslogtreecommitdiffstats
path: root/libcxx/test/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/language.support/support.exception/uncaught/uncaught_exception.pass.cpp')
-rw-r--r--libcxx/test/language.support/support.exception/uncaught/uncaught_exception.pass.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/libcxx/test/language.support/support.exception/uncaught/uncaught_exception.pass.cpp b/libcxx/test/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
new file mode 100644
index 00000000000..33ee8770464
--- /dev/null
+++ b/libcxx/test/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test uncaught_exception
+
+#include <exception>
+#include <cassert>
+
+struct A
+{
+ ~A()
+ {
+ assert(std::uncaught_exception());
+ }
+};
+
+int main()
+{
+ try
+ {
+ A a;
+ assert(!std::uncaught_exception());
+ throw 1;
+ }
+ catch (...)
+ {
+ assert(!std::uncaught_exception());
+ }
+ assert(!std::uncaught_exception());
+}
OpenPOWER on IntegriCloud