aboutsummaryrefslogtreecommitdiff
path: root/test/std/diagnostics/syserr
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/diagnostics/syserr')
-rw-r--r--test/std/diagnostics/syserr/errc.pass.cpp104
-rw-r--r--test/std/diagnostics/syserr/syserr.compare/eq_error_code_error_code.pass.cpp106
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/nothing_to_do.pass.cpp12
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.derived/message.pass.cpp34
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp40
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/eq.pass.cpp26
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/lt.pass.cpp26
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/neq.pass.cpp26
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp25
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp29
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.overview/error_category.pass.cpp19
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/default_error_condition.pass.cpp25
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/equivalent_error_code_int.pass.cpp24
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/equivalent_int_error_condition.pass.cpp25
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/nothing_to_do.pass.cpp12
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/ErrorCodeEnum.pass.cpp44
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/default.pass.cpp24
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/int_error_category.pass.cpp31
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/ErrorCodeEnum.pass.cpp45
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/assign.pass.cpp33
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/clear.pass.cpp30
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/lt.pass.cpp27
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/make_error_code.pass.cpp26
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/stream_inserter.pass.cpp27
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.pass.cpp30
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/category.pass.cpp23
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/default_error_condition.pass.cpp31
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/message.pass.cpp24
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/value.pass.cpp23
-rw-r--r--test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/nothing_to_do.pass.cpp12
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/nothing_to_do.pass.cpp12
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/ErrorConditionEnum.pass.cpp26
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/default.pass.cpp24
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/int_error_category.pass.cpp31
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/ErrorConditionEnum.pass.cpp27
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/assign.pass.cpp33
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/clear.pass.cpp30
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.nonmembers/lt.pass.cpp27
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.nonmembers/make_error_condition.pass.cpp26
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/bool.pass.cpp30
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/category.pass.cpp23
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/message.pass.cpp24
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/value.pass.cpp23
-rw-r--r--test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/nothing_to_do.pass.cpp12
-rw-r--r--test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp42
-rw-r--r--test/std/diagnostics/syserr/syserr.syserr/nothing_to_do.pass.cpp12
-rw-r--r--test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code.pass.cpp29
-rw-r--r--test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_const_char_pointer.pass.cpp30
-rw-r--r--test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp30
-rw-r--r--test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category.pass.cpp29
-rw-r--r--test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_const_char_pointer.pass.cpp31
-rw-r--r--test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp31
-rw-r--r--test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.overview/nothing_to_do.pass.cpp12
-rw-r--r--test/std/diagnostics/syserr/version.pass.cpp20
54 files changed, 1577 insertions, 0 deletions
diff --git a/test/std/diagnostics/syserr/errc.pass.cpp b/test/std/diagnostics/syserr/errc.pass.cpp
new file mode 100644
index 000000000000..247e10bf8d6b
--- /dev/null
+++ b/test/std/diagnostics/syserr/errc.pass.cpp
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// enum errc {...}
+
+#include <system_error>
+
+int main()
+{
+ static_assert(static_cast<int>(std::errc::address_family_not_supported) == EAFNOSUPPORT, "");
+ static_assert(static_cast<int>(std::errc::address_in_use) == EADDRINUSE, "");
+ static_assert(static_cast<int>(std::errc::address_not_available) == EADDRNOTAVAIL, "");
+ static_assert(static_cast<int>(std::errc::already_connected) == EISCONN, "");
+ static_assert(static_cast<int>(std::errc::argument_list_too_long) == E2BIG, "");
+ static_assert(static_cast<int>(std::errc::argument_out_of_domain) == EDOM, "");
+ static_assert(static_cast<int>(std::errc::bad_address) == EFAULT, "");
+ static_assert(static_cast<int>(std::errc::bad_file_descriptor) == EBADF, "");
+ static_assert(static_cast<int>(std::errc::bad_message) == EBADMSG, "");
+ static_assert(static_cast<int>(std::errc::broken_pipe) == EPIPE, "");
+ static_assert(static_cast<int>(std::errc::connection_aborted) == ECONNABORTED, "");
+ static_assert(static_cast<int>(std::errc::connection_already_in_progress) == EALREADY, "");
+ static_assert(static_cast<int>(std::errc::connection_refused) == ECONNREFUSED, "");
+ static_assert(static_cast<int>(std::errc::connection_reset) == ECONNRESET, "");
+ static_assert(static_cast<int>(std::errc::cross_device_link) == EXDEV, "");
+ static_assert(static_cast<int>(std::errc::destination_address_required) == EDESTADDRREQ, "");
+ static_assert(static_cast<int>(std::errc::device_or_resource_busy) == EBUSY, "");
+ static_assert(static_cast<int>(std::errc::directory_not_empty) == ENOTEMPTY, "");
+ static_assert(static_cast<int>(std::errc::executable_format_error) == ENOEXEC, "");
+ static_assert(static_cast<int>(std::errc::file_exists) == EEXIST, "");
+ static_assert(static_cast<int>(std::errc::file_too_large) == EFBIG, "");
+ static_assert(static_cast<int>(std::errc::filename_too_long) == ENAMETOOLONG, "");
+ static_assert(static_cast<int>(std::errc::function_not_supported) == ENOSYS, "");
+ static_assert(static_cast<int>(std::errc::host_unreachable) == EHOSTUNREACH, "");
+ static_assert(static_cast<int>(std::errc::identifier_removed) == EIDRM, "");
+ static_assert(static_cast<int>(std::errc::illegal_byte_sequence) == EILSEQ, "");
+ static_assert(static_cast<int>(std::errc::inappropriate_io_control_operation) == ENOTTY, "");
+ static_assert(static_cast<int>(std::errc::interrupted) == EINTR, "");
+ static_assert(static_cast<int>(std::errc::invalid_argument) == EINVAL, "");
+ static_assert(static_cast<int>(std::errc::invalid_seek) == ESPIPE, "");
+ static_assert(static_cast<int>(std::errc::io_error) == EIO, "");
+ static_assert(static_cast<int>(std::errc::is_a_directory) == EISDIR, "");
+ static_assert(static_cast<int>(std::errc::message_size) == EMSGSIZE, "");
+ static_assert(static_cast<int>(std::errc::network_down) == ENETDOWN, "");
+ static_assert(static_cast<int>(std::errc::network_reset) == ENETRESET, "");
+ static_assert(static_cast<int>(std::errc::network_unreachable) == ENETUNREACH, "");
+ static_assert(static_cast<int>(std::errc::no_buffer_space) == ENOBUFS, "");
+ static_assert(static_cast<int>(std::errc::no_child_process) == ECHILD, "");
+ static_assert(static_cast<int>(std::errc::no_link) == ENOLINK, "");
+ static_assert(static_cast<int>(std::errc::no_lock_available) == ENOLCK, "");
+#if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1)
+ static_assert(static_cast<int>(std::errc::no_message_available) == ENODATA, "");
+#endif
+ static_assert(static_cast<int>(std::errc::no_message) == ENOMSG, "");
+ static_assert(static_cast<int>(std::errc::no_protocol_option) == ENOPROTOOPT, "");
+ static_assert(static_cast<int>(std::errc::no_space_on_device) == ENOSPC, "");
+#if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1)
+ static_assert(static_cast<int>(std::errc::no_stream_resources) == ENOSR, "");
+#endif
+ static_assert(static_cast<int>(std::errc::no_such_device_or_address) == ENXIO, "");
+ static_assert(static_cast<int>(std::errc::no_such_device) == ENODEV, "");
+ static_assert(static_cast<int>(std::errc::no_such_file_or_directory) == ENOENT, "");
+ static_assert(static_cast<int>(std::errc::no_such_process) == ESRCH, "");
+ static_assert(static_cast<int>(std::errc::not_a_directory) == ENOTDIR, "");
+ static_assert(static_cast<int>(std::errc::not_a_socket) == ENOTSOCK, "");
+#if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1)
+ static_assert(static_cast<int>(std::errc::not_a_stream) == ENOSTR, "");
+#endif
+ static_assert(static_cast<int>(std::errc::not_connected) == ENOTCONN, "");
+ static_assert(static_cast<int>(std::errc::not_enough_memory) == ENOMEM, "");
+ static_assert(static_cast<int>(std::errc::not_supported) == ENOTSUP, "");
+ static_assert(static_cast<int>(std::errc::operation_canceled) == ECANCELED, "");
+ static_assert(static_cast<int>(std::errc::operation_in_progress) == EINPROGRESS, "");
+ static_assert(static_cast<int>(std::errc::operation_not_permitted) == EPERM, "");
+ static_assert(static_cast<int>(std::errc::operation_not_supported) == EOPNOTSUPP, "");
+ static_assert(static_cast<int>(std::errc::operation_would_block) == EWOULDBLOCK, "");
+ static_assert(static_cast<int>(std::errc::owner_dead) == EOWNERDEAD, "");
+ static_assert(static_cast<int>(std::errc::permission_denied) == EACCES, "");
+ static_assert(static_cast<int>(std::errc::protocol_error) == EPROTO, "");
+ static_assert(static_cast<int>(std::errc::protocol_not_supported) == EPROTONOSUPPORT, "");
+ static_assert(static_cast<int>(std::errc::read_only_file_system) == EROFS, "");
+ static_assert(static_cast<int>(std::errc::resource_deadlock_would_occur) == EDEADLK, "");
+ static_assert(static_cast<int>(std::errc::resource_unavailable_try_again) == EAGAIN, "");
+ static_assert(static_cast<int>(std::errc::result_out_of_range) == ERANGE, "");
+ static_assert(static_cast<int>(std::errc::state_not_recoverable) == ENOTRECOVERABLE, "");
+#if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1)
+ static_assert(static_cast<int>(std::errc::stream_timeout) == ETIME, "");
+#endif
+ static_assert(static_cast<int>(std::errc::text_file_busy) == ETXTBSY, "");
+ static_assert(static_cast<int>(std::errc::timed_out) == ETIMEDOUT, "");
+ static_assert(static_cast<int>(std::errc::too_many_files_open_in_system) == ENFILE, "");
+ static_assert(static_cast<int>(std::errc::too_many_files_open) == EMFILE, "");
+ static_assert(static_cast<int>(std::errc::too_many_links) == EMLINK, "");
+ static_assert(static_cast<int>(std::errc::too_many_symbolic_link_levels) == ELOOP, "");
+ static_assert(static_cast<int>(std::errc::value_too_large) == EOVERFLOW, "");
+ static_assert(static_cast<int>(std::errc::wrong_protocol_type) == EPROTOTYPE, "");
+}
diff --git a/test/std/diagnostics/syserr/syserr.compare/eq_error_code_error_code.pass.cpp b/test/std/diagnostics/syserr/syserr.compare/eq_error_code_error_code.pass.cpp
new file mode 100644
index 000000000000..e2e7aeda822b
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.compare/eq_error_code_error_code.pass.cpp
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// bool operator==(const error_code& lhs, const error_code& rhs);
+// bool operator==(const error_code& lhs, const error_condition& rhs);
+// bool operator==(const error_condition& lhs, const error_code& rhs);
+// bool operator==(const error_condition& lhs, const error_condition& rhs);
+// bool operator!=(const error_code& lhs, const error_code& rhs);
+// bool operator!=(const error_code& lhs, const error_condition& rhs);
+// bool operator!=(const error_condition& lhs, const error_code& rhs);
+// bool operator!=(const error_condition& lhs, const error_condition& rhs);
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ std::error_code e_code1(5, std::generic_category());
+ std::error_code e_code2(5, std::system_category());
+ std::error_code e_code3(6, std::generic_category());
+ std::error_code e_code4(6, std::system_category());
+ std::error_condition e_condition1(5, std::generic_category());
+ std::error_condition e_condition2(5, std::system_category());
+ std::error_condition e_condition3(6, std::generic_category());
+ std::error_condition e_condition4(6, std::system_category());
+
+ assert(e_code1 == e_code1);
+ assert(e_code1 != e_code2);
+ assert(e_code1 != e_code3);
+ assert(e_code1 != e_code4);
+ assert(e_code1 == e_condition1);
+ assert(e_code1 != e_condition2);
+ assert(e_code1 != e_condition3);
+ assert(e_code1 != e_condition4);
+
+ assert(e_code2 != e_code1);
+ assert(e_code2 == e_code2);
+ assert(e_code2 != e_code3);
+ assert(e_code2 != e_code4);
+ assert(e_code2 == e_condition1); // ?
+ assert(e_code2 == e_condition2);
+ assert(e_code2 != e_condition3);
+ assert(e_code2 != e_condition4);
+
+ assert(e_code3 != e_code1);
+ assert(e_code3 != e_code2);
+ assert(e_code3 == e_code3);
+ assert(e_code3 != e_code4);
+ assert(e_code3 != e_condition1);
+ assert(e_code3 != e_condition2);
+ assert(e_code3 == e_condition3);
+ assert(e_code3 != e_condition4);
+
+ assert(e_code4 != e_code1);
+ assert(e_code4 != e_code2);
+ assert(e_code4 != e_code3);
+ assert(e_code4 == e_code4);
+ assert(e_code4 != e_condition1);
+ assert(e_code4 != e_condition2);
+ assert(e_code4 == e_condition3); // ?
+ assert(e_code4 == e_condition4);
+
+ assert(e_condition1 == e_code1);
+ assert(e_condition1 == e_code2); // ?
+ assert(e_condition1 != e_code3);
+ assert(e_condition1 != e_code4);
+ assert(e_condition1 == e_condition1);
+ assert(e_condition1 != e_condition2);
+ assert(e_condition1 != e_condition3);
+ assert(e_condition1 != e_condition4);
+
+ assert(e_condition2 != e_code1);
+ assert(e_condition2 == e_code2);
+ assert(e_condition2 != e_code3);
+ assert(e_condition2 != e_code4);
+ assert(e_condition2 != e_condition1);
+ assert(e_condition2 == e_condition2);
+ assert(e_condition2 != e_condition3);
+ assert(e_condition2 != e_condition4);
+
+ assert(e_condition3 != e_code1);
+ assert(e_condition3 != e_code2);
+ assert(e_condition3 == e_code3);
+ assert(e_condition3 == e_code4); // ?
+ assert(e_condition3 != e_condition1);
+ assert(e_condition3 != e_condition2);
+ assert(e_condition3 == e_condition3);
+ assert(e_condition3 != e_condition4);
+
+ assert(e_condition4 != e_code1);
+ assert(e_condition4 != e_code2);
+ assert(e_condition4 != e_code3);
+ assert(e_condition4 == e_code4);
+ assert(e_condition4 != e_condition1);
+ assert(e_condition4 != e_condition2);
+ assert(e_condition4 != e_condition3);
+ assert(e_condition4 == e_condition4);
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/nothing_to_do.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.derived/message.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.derived/message.pass.cpp
new file mode 100644
index 000000000000..82770fb438b1
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.derived/message.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+// virtual string message(int ev) const = 0;
+
+#include <system_error>
+#include <cassert>
+#include <string>
+
+#include <stdio.h>
+
+int main()
+{
+ const std::error_category& e_cat1 = std::generic_category();
+ const std::error_category& e_cat2 = std::system_category();
+ std::string m1 = e_cat1.message(5);
+ std::string m2 = e_cat2.message(5);
+ std::string m3 = e_cat2.message(6);
+ assert(!m1.empty());
+ assert(!m2.empty());
+ assert(!m3.empty());
+ assert(m1 == m2);
+ assert(m1 != m3);
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp
new file mode 100644
index 000000000000..0573ef862efd
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+// constexpr error_category() noexcept;
+
+#include <system_error>
+#include <type_traits>
+#include <string>
+#include <cassert>
+
+#if _LIBCPP_STD_VER > 11
+
+class test1
+ : public std::error_category
+{
+public:
+ constexpr test1() = default; // won't compile if error_category() is not constexpr
+ virtual const char* name() const noexcept {return nullptr;}
+ virtual std::string message(int ev) const {return std::string();}
+};
+
+#endif // _LIBCPP_STD_VER > 11
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+ static_assert(std::is_nothrow_default_constructible<test1>::value,
+ "error_category() must exist and be noexcept");
+#endif // _LIBCPP_STD_VER > 11
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/eq.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/eq.pass.cpp
new file mode 100644
index 000000000000..bec5e630aecf
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/eq.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+// bool operator==(const error_category& rhs) const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_category& e_cat1 = std::generic_category();
+ const std::error_category& e_cat2 = std::generic_category();
+ const std::error_category& e_cat3 = std::system_category();
+ assert(e_cat1 == e_cat2);
+ assert(!(e_cat1 == e_cat3));
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/lt.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/lt.pass.cpp
new file mode 100644
index 000000000000..707604e486a4
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/lt.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+// bool operator<(const error_category& rhs) const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_category& e_cat1 = std::generic_category();
+ const std::error_category& e_cat2 = std::generic_category();
+ const std::error_category& e_cat3 = std::system_category();
+ assert(!(e_cat1 < e_cat2) && !(e_cat2 < e_cat1));
+ assert((e_cat1 < e_cat3) || (e_cat3 < e_cat1));
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/neq.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/neq.pass.cpp
new file mode 100644
index 000000000000..e74458f3fbb6
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/neq.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+// bool operator!=(const error_category& rhs) const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_category& e_cat1 = std::generic_category();
+ const std::error_category& e_cat2 = std::generic_category();
+ const std::error_category& e_cat3 = std::system_category();
+ assert(!(e_cat1 != e_cat2));
+ assert(e_cat1 != e_cat3);
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
new file mode 100644
index 000000000000..972299936ddf
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+// const error_category& generic_category();
+
+#include <system_error>
+#include <cassert>
+#include <string>
+
+int main()
+{
+ const std::error_category& e_cat1 = std::generic_category();
+ std::string m1 = e_cat1.name();
+ assert(m1 == "generic");
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
new file mode 100644
index 000000000000..b5cb18ad7653
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+// const error_category& system_category();
+
+#include <system_error>
+#include <cassert>
+#include <string>
+
+int main()
+{
+ const std::error_category& e_cat1 = std::system_category();
+ std::error_condition e_cond = e_cat1.default_error_condition(5);
+ assert(e_cond.value() == 5);
+ assert(e_cond.category() == std::generic_category());
+ e_cond = e_cat1.default_error_condition(5000);
+ assert(e_cond.value() == 5000);
+ assert(e_cond.category() == std::system_category());
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.overview/error_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.overview/error_category.pass.cpp
new file mode 100644
index 000000000000..235305878390
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.overview/error_category.pass.cpp
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+#include <system_error>
+
+int main()
+{
+ std::error_category* p = 0;
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/default_error_condition.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/default_error_condition.pass.cpp
new file mode 100644
index 000000000000..dd51827128b1
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/default_error_condition.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+// virtual error_condition default_error_condition(int ev) const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_category& e_cat = std::generic_category();
+ std::error_condition e_cond = e_cat.default_error_condition(static_cast<int>(std::errc::not_a_directory));
+ assert(e_cond.category() == e_cat);
+ assert(e_cond.value() == static_cast<int>(std::errc::not_a_directory));
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/equivalent_error_code_int.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/equivalent_error_code_int.pass.cpp
new file mode 100644
index 000000000000..d26541d943f3
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/equivalent_error_code_int.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+// virtual bool equivalent(const error_code& code, int condition) const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_category& e_cat = std::generic_category();
+ assert(e_cat.equivalent(std::error_code(5, e_cat), 5));
+ assert(!e_cat.equivalent(std::error_code(5, e_cat), 6));
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/equivalent_int_error_condition.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/equivalent_int_error_condition.pass.cpp
new file mode 100644
index 000000000000..d7cf844dffe4
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.virtuals/equivalent_int_error_condition.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_category
+
+// virtual bool equivalent(int code, const error_condition& condition) const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_category& e_cat = std::generic_category();
+ std::error_condition e_cond = e_cat.default_error_condition(5);
+ assert(e_cat.equivalent(5, e_cond));
+ assert(!e_cat.equivalent(6, e_cond));
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/nothing_to_do.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/ErrorCodeEnum.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/ErrorCodeEnum.pass.cpp
new file mode 100644
index 000000000000..0100b1c77724
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/ErrorCodeEnum.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// template <ErrorCodeEnum E> error_code(E e);
+
+#include <system_error>
+#include <cassert>
+
+enum testing
+{
+ zero, one, two
+};
+
+namespace std
+{
+
+template <> struct is_error_code_enum<testing> : public std::true_type {};
+
+}
+
+std::error_code
+make_error_code(testing x)
+{
+ return std::error_code(static_cast<int>(x), std::generic_category());
+}
+
+int main()
+{
+ {
+ std::error_code ec(two);
+ assert(ec.value() == 2);
+ assert(ec.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/default.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/default.pass.cpp
new file mode 100644
index 000000000000..569681b751e8
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/default.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// error_code();
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ std::error_code ec;
+ assert(ec.value() == 0);
+ assert(ec.category() == std::system_category());
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/int_error_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/int_error_category.pass.cpp
new file mode 100644
index 000000000000..56489bb71b17
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/int_error_category.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// error_code(int val, const error_category& cat);
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ std::error_code ec(6, std::system_category());
+ assert(ec.value() == 6);
+ assert(ec.category() == std::system_category());
+ }
+ {
+ std::error_code ec(8, std::generic_category());
+ assert(ec.value() == 8);
+ assert(ec.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/ErrorCodeEnum.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/ErrorCodeEnum.pass.cpp
new file mode 100644
index 000000000000..6c073c9fd151
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/ErrorCodeEnum.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// template <ErrorCodeEnum E> error_code& operator=(E e);
+
+#include <system_error>
+#include <cassert>
+
+enum testing
+{
+ zero, one, two
+};
+
+namespace std
+{
+
+template <> struct is_error_code_enum<testing> : public std::true_type {};
+
+}
+
+std::error_code
+make_error_code(testing x)
+{
+ return std::error_code(static_cast<int>(x), std::generic_category());
+}
+
+int main()
+{
+ {
+ std::error_code ec;
+ ec = two;
+ assert(ec.value() == 2);
+ assert(ec.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/assign.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/assign.pass.cpp
new file mode 100644
index 000000000000..967692a4f1dc
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/assign.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// void assign(int val, const error_category& cat);
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ std::error_code ec;
+ ec.assign(6, std::system_category());
+ assert(ec.value() == 6);
+ assert(ec.category() == std::system_category());
+ }
+ {
+ std::error_code ec;
+ ec.assign(8, std::generic_category());
+ assert(ec.value() == 8);
+ assert(ec.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/clear.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/clear.pass.cpp
new file mode 100644
index 000000000000..83faa03d28fa
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/clear.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// void clear();
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ std::error_code ec;
+ ec.assign(6, std::generic_category());
+ assert(ec.value() == 6);
+ assert(ec.category() == std::generic_category());
+ ec.clear();
+ assert(ec.value() == 0);
+ assert(ec.category() == std::system_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/lt.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/lt.pass.cpp
new file mode 100644
index 000000000000..01abc42b3ea9
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/lt.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// bool operator<(const error_code& lhs, const error_code& rhs);
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::error_code ec1(6, std::generic_category());
+ const std::error_code ec2(7, std::generic_category());
+ assert(ec1 < ec2);
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/make_error_code.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/make_error_code.pass.cpp
new file mode 100644
index 000000000000..fc4e0f2b25eb
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/make_error_code.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// error_code make_error_code(errc e);
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ std::error_code ec = make_error_code(std::errc::operation_canceled);
+ assert(ec.value() == static_cast<int>(std::errc::operation_canceled));
+ assert(ec.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/stream_inserter.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/stream_inserter.pass.cpp
new file mode 100644
index 000000000000..09c87e5cea1c
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.nonmembers/stream_inserter.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// template <class charT, class traits>
+// basic_ostream<charT,traits>&
+// operator<<(basic_ostream<charT,traits>& os, const error_code& ec);
+
+#include <system_error>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ std::ostringstream out;
+ out << std::error_code(std::io_errc::stream);
+ assert(out.str() == "iostream:1");
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.pass.cpp
new file mode 100644
index 000000000000..0b20024013fc
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// explicit operator bool() const;
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::error_code ec(6, std::generic_category());
+ assert(static_cast<bool>(ec));
+ }
+ {
+ const std::error_code ec(0, std::generic_category());
+ assert(!static_cast<bool>(ec));
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/category.pass.cpp
new file mode 100644
index 000000000000..f2e50cf65ce1
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/category.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// const error_category& category() const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_code ec(6, std::generic_category());
+ assert(ec.category() == std::generic_category());
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/default_error_condition.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/default_error_condition.pass.cpp
new file mode 100644
index 000000000000..0a67cd5db6ad
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/default_error_condition.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// error_condition default_error_condition() const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::error_code ec(6, std::generic_category());
+ std::error_condition e_cond = ec.default_error_condition();
+ assert(e_cond == ec);
+ }
+ {
+ const std::error_code ec(6, std::system_category());
+ std::error_condition e_cond = ec.default_error_condition();
+ assert(e_cond == ec);
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/message.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/message.pass.cpp
new file mode 100644
index 000000000000..530f42ca9b89
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/message.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// string message() const;
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ const std::error_code ec(6, std::generic_category());
+ assert(ec.message() == std::generic_category().message(6));
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/value.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/value.pass.cpp
new file mode 100644
index 000000000000..1047b7d4213e
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/value.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_code
+
+// int value() const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_code ec(6, std::system_category());
+ assert(ec.value() == 6);
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/nothing_to_do.pass.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/nothing_to_do.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/ErrorConditionEnum.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/ErrorConditionEnum.pass.cpp
new file mode 100644
index 000000000000..fbc03f1aa029
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/ErrorConditionEnum.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// template <ErrorConditionEnum E> error_condition(E e);
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ std::error_condition ec(std::errc::not_a_directory);
+ assert(ec.value() == static_cast<int>(std::errc::not_a_directory));
+ assert(ec.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/default.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/default.pass.cpp
new file mode 100644
index 000000000000..a430ee2f7d82
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/default.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// error_condition();
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ std::error_condition ec;
+ assert(ec.value() == 0);
+ assert(ec.category() == std::generic_category());
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/int_error_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/int_error_category.pass.cpp
new file mode 100644
index 000000000000..f3b9eada7651
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/int_error_category.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// error_condition(int val, const error_category& cat);
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ std::error_condition ec(6, std::system_category());
+ assert(ec.value() == 6);
+ assert(ec.category() == std::system_category());
+ }
+ {
+ std::error_condition ec(8, std::generic_category());
+ assert(ec.value() == 8);
+ assert(ec.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/ErrorConditionEnum.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/ErrorConditionEnum.pass.cpp
new file mode 100644
index 000000000000..3773872c7e39
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/ErrorConditionEnum.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// template <ErrorConditionEnum E> error_condition& operator=(E e);
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ std::error_condition ec;
+ ec = std::errc::not_enough_memory;
+ assert(ec.value() == static_cast<int>(std::errc::not_enough_memory));
+ assert(ec.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/assign.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/assign.pass.cpp
new file mode 100644
index 000000000000..8fcfcc3603a5
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/assign.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// void assign(int val, const error_category& cat);
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ std::error_condition ec;
+ ec.assign(6, std::system_category());
+ assert(ec.value() == 6);
+ assert(ec.category() == std::system_category());
+ }
+ {
+ std::error_condition ec;
+ ec.assign(8, std::generic_category());
+ assert(ec.value() == 8);
+ assert(ec.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/clear.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/clear.pass.cpp
new file mode 100644
index 000000000000..509a8b981187
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/clear.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// void clear();
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ std::error_condition ec;
+ ec.assign(6, std::system_category());
+ assert(ec.value() == 6);
+ assert(ec.category() == std::system_category());
+ ec.clear();
+ assert(ec.value() == 0);
+ assert(ec.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.nonmembers/lt.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.nonmembers/lt.pass.cpp
new file mode 100644
index 000000000000..7ab063853d9d
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.nonmembers/lt.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// bool operator<(const error_condition& lhs, const error_condition& rhs);
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::error_condition ec1(6, std::generic_category());
+ const std::error_condition ec2(7, std::generic_category());
+ assert(ec1 < ec2);
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.nonmembers/make_error_condition.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.nonmembers/make_error_condition.pass.cpp
new file mode 100644
index 000000000000..acefc4655abf
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.nonmembers/make_error_condition.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// error_condition make_error_condition(errc e);
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::error_condition ec1 = std::make_error_condition(std::errc::message_size);
+ assert(ec1.value() == static_cast<int>(std::errc::message_size));
+ assert(ec1.category() == std::generic_category());
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/bool.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/bool.pass.cpp
new file mode 100644
index 000000000000..edeca06d38b5
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/bool.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// explicit operator bool() const;
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ {
+ const std::error_condition ec(6, std::generic_category());
+ assert(static_cast<bool>(ec));
+ }
+ {
+ const std::error_condition ec(0, std::generic_category());
+ assert(!static_cast<bool>(ec));
+ }
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/category.pass.cpp
new file mode 100644
index 000000000000..fd3e698566b2
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/category.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// const error_category& category() const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_condition ec(6, std::generic_category());
+ assert(ec.category() == std::generic_category());
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/message.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/message.pass.cpp
new file mode 100644
index 000000000000..6a60f50f410d
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/message.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// string message() const;
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ const std::error_condition ec(6, std::generic_category());
+ assert(ec.message() == std::generic_category().message(6));
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/value.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/value.pass.cpp
new file mode 100644
index 000000000000..c755673126bd
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.observers/value.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class error_condition
+
+// int value() const;
+
+#include <system_error>
+#include <cassert>
+
+int main()
+{
+ const std::error_condition ec(6, std::system_category());
+ assert(ec.value() == 6);
+}
diff --git a/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/nothing_to_do.pass.cpp b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
new file mode 100644
index 000000000000..b812e364bbc5
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template <class T>
+// struct hash
+// : public unary_function<T, size_t>
+// {
+// size_t operator()(T val) const;
+// };
+
+// Not very portable
+
+#include <system_error>
+#include <cassert>
+#include <type_traits>
+
+void
+test(int i)
+{
+ typedef std::error_code T;
+ typedef std::hash<T> H;
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
+ H h;
+ T ec(i, std::system_category());
+ assert(h(ec) == i);
+}
+
+int main()
+{
+ test(0);
+ test(2);
+ test(10);
+}
diff --git a/test/std/diagnostics/syserr/syserr.syserr/nothing_to_do.pass.cpp b/test/std/diagnostics/syserr/syserr.syserr/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.syserr/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code.pass.cpp b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code.pass.cpp
new file mode 100644
index 000000000000..c059ba3253c2
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class system_error
+
+// system_error(error_code ec);
+
+// Test is slightly non-portable
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ std::system_error se(static_cast<int>(std::errc::not_a_directory),
+ std::generic_category(), "some text");
+ assert(se.code() == std::make_error_code(std::errc::not_a_directory));
+ std::string what_message(se.what());
+ assert(what_message.find("Not a directory") != std::string::npos);
+}
diff --git a/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_const_char_pointer.pass.cpp b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_const_char_pointer.pass.cpp
new file mode 100644
index 000000000000..cd8e3fefbf99
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_const_char_pointer.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class system_error
+
+// system_error(error_code ec, const char* what_arg);
+
+// Test is slightly non-portable
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ std::string what_arg("test message");
+ std::system_error se(make_error_code(std::errc::not_a_directory), what_arg.c_str());
+ assert(se.code() == std::make_error_code(std::errc::not_a_directory));
+ std::string what_message(se.what());
+ assert(what_message.find(what_arg) != std::string::npos);
+ assert(what_message.find("Not a directory") != std::string::npos);
+}
diff --git a/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp
new file mode 100644
index 000000000000..b891a6d973d4
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class system_error
+
+// system_error(error_code ec, const string& what_arg);
+
+// Test is slightly non-portable
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ std::string what_arg("test message");
+ std::system_error se(make_error_code(std::errc::not_a_directory), what_arg);
+ assert(se.code() == std::make_error_code(std::errc::not_a_directory));
+ std::string what_message(se.what());
+ assert(what_message.find(what_arg) != std::string::npos);
+ assert(what_message.find("Not a directory") != std::string::npos);
+}
diff --git a/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category.pass.cpp b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category.pass.cpp
new file mode 100644
index 000000000000..acf6387fc24a
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class system_error
+
+// system_error(int ev, const error_category& ecat);
+
+// Test is slightly non-portable
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ std::system_error se(static_cast<int>(std::errc::not_a_directory),
+ std::generic_category());
+ assert(se.code() == std::make_error_code(std::errc::not_a_directory));
+ std::string what_message(se.what());
+ assert(what_message.find("Not a directory") != std::string::npos);
+}
diff --git a/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_const_char_pointer.pass.cpp b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_const_char_pointer.pass.cpp
new file mode 100644
index 000000000000..4f697016ce15
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_const_char_pointer.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class system_error
+
+// system_error(int ev, const error_category& ecat, const char* what_arg);
+
+// Test is slightly non-portable
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ std::string what_arg("test message");
+ std::system_error se(static_cast<int>(std::errc::not_a_directory),
+ std::generic_category(), what_arg.c_str());
+ assert(se.code() == std::make_error_code(std::errc::not_a_directory));
+ std::string what_message(se.what());
+ assert(what_message.find(what_arg) != std::string::npos);
+ assert(what_message.find("Not a directory") != std::string::npos);
+}
diff --git a/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp
new file mode 100644
index 000000000000..87814b19079b
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+// class system_error
+
+// system_error(int ev, const error_category& ecat, const string& what_arg);
+
+// Test is slightly non-portable
+
+#include <system_error>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ std::string what_arg("test message");
+ std::system_error se(static_cast<int>(std::errc::not_a_directory),
+ std::generic_category(), what_arg);
+ assert(se.code() == std::make_error_code(std::errc::not_a_directory));
+ std::string what_message(se.what());
+ assert(what_message.find(what_arg) != std::string::npos);
+ assert(what_message.find("Not a directory") != std::string::npos);
+}
diff --git a/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.overview/nothing_to_do.pass.cpp b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.overview/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..b58f5c55b643
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.overview/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/diagnostics/syserr/version.pass.cpp b/test/std/diagnostics/syserr/version.pass.cpp
new file mode 100644
index 000000000000..3851150fdf90
--- /dev/null
+++ b/test/std/diagnostics/syserr/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <system_error>
+
+#include <system_error>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}