summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/noexcept06.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/noexcept06.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept06.C30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept06.C b/gcc/testsuite/g++.dg/cpp0x/noexcept06.C
new file mode 100644
index 000000000..3babdffda
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept06.C
@@ -0,0 +1,30 @@
+// Test that checking of a nothrow specification uses the one on the
+// definition.
+// { dg-options "-std=c++0x" }
+// { dg-do run }
+
+#include <exception>
+#include <cstdlib>
+
+void my_unexpected ()
+{
+ std::abort ();
+}
+void my_terminate ()
+{
+ std::exit (0);
+}
+
+void f() throw();
+void f() noexcept
+{
+ throw 1;
+}
+
+int main()
+{
+ std::set_unexpected (my_unexpected);
+ std::set_terminate (my_terminate);
+ f();
+ return 1;
+}