summaryrefslogtreecommitdiff
path: root/test/std/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/diagnostics')
-rw-r--r--test/std/diagnostics/assertions/cassert.pass.cpp24
-rw-r--r--test/std/diagnostics/diagnostics.general/nothing_to_do.pass.cpp12
-rw-r--r--test/std/diagnostics/errno/cerrno.pass.cpp349
-rw-r--r--test/std/diagnostics/nothing_to_do.pass.cpp12
-rw-r--r--test/std/diagnostics/std.exceptions/domain.error/domain_error.pass.cpp42
-rw-r--r--test/std/diagnostics/std.exceptions/invalid.argument/invalid_argument.pass.cpp42
-rw-r--r--test/std/diagnostics/std.exceptions/length.error/length_error.pass.cpp42
-rw-r--r--test/std/diagnostics/std.exceptions/logic.error/logic_error.pass.cpp42
-rw-r--r--test/std/diagnostics/std.exceptions/out.of.range/out_of_range.pass.cpp42
-rw-r--r--test/std/diagnostics/std.exceptions/overflow.error/overflow_error.pass.cpp42
-rw-r--r--test/std/diagnostics/std.exceptions/range.error/range_error.pass.cpp42
-rw-r--r--test/std/diagnostics/std.exceptions/runtime.error/runtime_error.pass.cpp42
-rw-r--r--test/std/diagnostics/std.exceptions/underflow.error/underflow_error.pass.cpp42
-rw-r--r--test/std/diagnostics/std.exceptions/version.pass.cpp20
-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
68 files changed, 2372 insertions, 0 deletions
diff --git a/test/std/diagnostics/assertions/cassert.pass.cpp b/test/std/diagnostics/assertions/cassert.pass.cpp
new file mode 100644
index 0000000000000..bed7a394ee4a6
--- /dev/null
+++ b/test/std/diagnostics/assertions/cassert.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.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cassert>
+
+#include <cassert>
+
+#ifndef assert
+#error assert not defined
+#endif
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/diagnostics/diagnostics.general/nothing_to_do.pass.cpp b/test/std/diagnostics/diagnostics.general/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/diagnostics/diagnostics.general/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/errno/cerrno.pass.cpp b/test/std/diagnostics/errno/cerrno.pass.cpp
new file mode 100644
index 0000000000000..c6743fb79e7fd
--- /dev/null
+++ b/test/std/diagnostics/errno/cerrno.pass.cpp
@@ -0,0 +1,349 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cerrno>
+
+#include <cerrno>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+#ifndef E2BIG
+#error E2BIG not defined
+#endif
+
+#ifndef EACCES
+#error EACCES not defined
+#endif
+
+#ifndef EACCES
+#error EACCES not defined
+#endif
+
+#ifndef EADDRINUSE
+#error EADDRINUSE not defined
+#endif
+
+#ifndef EADDRNOTAVAIL
+#error EADDRNOTAVAIL not defined
+#endif
+
+#ifndef EAFNOSUPPORT
+#error EAFNOSUPPORT not defined
+#endif
+
+#ifndef EAGAIN
+#error EAGAIN not defined
+#endif
+
+#ifndef EALREADY
+#error EALREADY not defined
+#endif
+
+#ifndef EBADF
+#error EBADF not defined
+#endif
+
+#ifndef EBADMSG
+#error EBADMSG not defined
+#endif
+
+#ifndef EBUSY
+#error EBUSY not defined
+#endif
+
+#ifndef ECANCELED
+#error ECANCELED not defined
+#endif
+
+#ifndef ECHILD
+#error ECHILD not defined
+#endif
+
+#ifndef ECONNABORTED
+#error ECONNABORTED not defined
+#endif
+
+#ifndef ECONNREFUSED
+#error ECONNREFUSED not defined
+#endif
+
+#ifndef ECONNRESET
+#error ECONNRESET not defined
+#endif
+
+#ifndef EDEADLK
+#error EDEADLK not defined
+#endif
+
+#ifndef EDESTADDRREQ
+#error EDESTADDRREQ not defined
+#endif
+
+#ifndef EDOM
+#error EDOM not defined
+#endif
+
+#ifndef EEXIST
+#error EEXIST not defined
+#endif
+
+#ifndef EFAULT
+#error EFAULT not defined
+#endif
+
+#ifndef EFBIG
+#error EFBIG not defined
+#endif
+
+#ifndef EHOSTUNREACH
+#error EHOSTUNREACH not defined
+#endif
+
+#ifndef EIDRM
+#error EIDRM not defined
+#endif
+
+#ifndef EILSEQ
+#error EILSEQ not defined
+#endif
+
+#ifndef EINPROGRESS
+#error EINPROGRESS not defined
+#endif
+
+#ifndef EINTR
+#error EINTR not defined
+#endif
+
+#ifndef EINVAL
+#error EINVAL not defined
+#endif
+
+#ifndef EIO
+#error EIO not defined
+#endif
+
+#ifndef EISCONN
+#error EISCONN not defined
+#endif
+
+#ifndef EISDIR
+#error EISDIR not defined
+#endif
+
+#ifndef ELOOP
+#error ELOOP not defined
+#endif
+
+#ifndef EMFILE
+#error EMFILE not defined
+#endif
+
+#ifndef EMLINK
+#error EMLINK not defined
+#endif
+
+#ifndef EMSGSIZE
+#error EMSGSIZE not defined
+#endif
+
+#ifndef ENAMETOOLONG
+#error ENAMETOOLONG not defined
+#endif
+
+#ifndef ENETDOWN
+#error ENETDOWN not defined
+#endif
+
+#ifndef ENETRESET
+#error ENETRESET not defined
+#endif
+
+#ifndef ENETUNREACH
+#error ENETUNREACH not defined
+#endif
+
+#ifndef ENFILE
+#error ENFILE not defined
+#endif
+
+#ifndef ENOBUFS
+#error ENOBUFS not defined
+#endif
+
+#if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1)
+#ifndef ENODATA
+#error ENODATA not defined
+#endif
+#endif
+
+#ifndef ENODEV
+#error ENODEV not defined
+#endif
+
+#ifndef ENOENT
+#error ENOENT not defined
+#endif
+
+#ifndef ENOEXEC
+#error ENOEXEC not defined
+#endif
+
+#ifndef ENOLCK
+#error ENOLCK not defined
+#endif
+
+#ifndef ENOLINK
+#error ENOLINK not defined
+#endif
+
+#ifndef ENOMEM
+#error ENOMEM not defined
+#endif
+
+#ifndef ENOMSG
+#error ENOMSG not defined
+#endif
+
+#ifndef ENOPROTOOPT
+#error ENOPROTOOPT not defined
+#endif
+
+#ifndef ENOSPC
+#error ENOSPC not defined
+#endif
+
+#if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1)
+#ifndef ENOSR
+#error ENOSR not defined
+#endif
+#endif
+
+#if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1)
+#ifndef ENOSTR
+#error ENOSTR not defined
+#endif
+#endif
+
+#ifndef ENOSYS
+#error ENOSYS not defined
+#endif
+
+#ifndef ENOTCONN
+#error ENOTCONN not defined
+#endif
+
+#ifndef ENOTDIR
+#error ENOTDIR not defined
+#endif
+
+#ifndef ENOTEMPTY
+#error ENOTEMPTY not defined
+#endif
+
+#ifndef ENOTRECOVERABLE
+#error ENOTRECOVERABLE not defined
+#endif
+
+#ifndef ENOTSOCK
+#error ENOTSOCK not defined
+#endif
+
+#ifndef ENOTSUP
+#error ENOTSUP not defined
+#endif
+
+#ifndef ENOTTY
+#error ENOTTY not defined
+#endif
+
+#ifndef ENXIO
+#error ENXIO not defined
+#endif
+
+#ifndef EOPNOTSUPP
+#error EOPNOTSUPP not defined
+#endif
+
+#ifndef EOVERFLOW
+#error EOVERFLOW not defined
+#endif
+
+#ifndef EOWNERDEAD
+#error EOWNERDEAD not defined
+#endif
+
+#ifndef EPERM
+#error EPERM not defined
+#endif
+
+#ifndef EPIPE
+#error EPIPE not defined
+#endif
+
+#ifndef EPROTO
+#error EPROTO not defined
+#endif
+
+#ifndef EPROTONOSUPPORT
+#error EPROTONOSUPPORT not defined
+#endif
+
+#ifndef EPROTOTYPE
+#error EPROTOTYPE not defined
+#endif
+
+#ifndef ERANGE
+#error ERANGE not defined
+#endif
+
+#ifndef EROFS
+#error EROFS not defined
+#endif
+
+#ifndef ESPIPE
+#error ESPIPE not defined
+#endif
+
+#ifndef ESRCH
+#error ESRCH not defined
+#endif
+
+#if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1)
+#ifndef ETIME
+#error ETIME not defined
+#endif
+#endif
+
+#ifndef ETIMEDOUT
+#error ETIMEDOUT not defined
+#endif
+
+#ifndef ETXTBSY
+#error ETXTBSY not defined
+#endif
+
+#ifndef EWOULDBLOCK
+#error EWOULDBLOCK not defined
+#endif
+
+#ifndef EXDEV
+#error EXDEV not defined
+#endif
+
+#ifndef errno
+#error errno not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/diagnostics/nothing_to_do.pass.cpp b/test/std/diagnostics/nothing_to_do.pass.cpp
new file mode 100644
index 0000000000000..b58f5c55b643a
--- /dev/null
+++ b/test/std/diagnostics/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/std.exceptions/domain.error/domain_error.pass.cpp b/test/std/diagnostics/std.exceptions/domain.error/domain_error.pass.cpp
new file mode 100644
index 0000000000000..5769d25053746
--- /dev/null
+++ b/test/std/diagnostics/std.exceptions/domain.error/domain_error.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.
+//
+//===----------------------------------------------------------------------===//
+
+// test domain_error
+
+#include <stdexcept>
+#include <type_traits>
+#include <cstring>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ static_assert((std::is_base_of<std::logic_error, std::domain_error>::value),
+ "std::is_base_of<std::logic_error, std::domain_error>::value");
+ static_assert(std::is_polymorphic<std::domain_error>::value,
+ "std::is_polymorphic<std::domain_error>::value");
+ {
+ const char* msg = "domain_error message";
+ std::domain_error e(msg);
+ assert(std::strcmp(e.what(), msg) == 0);
+ std::domain_error e2(e);
+ assert(std::strcmp(e2.what(), msg) == 0);
+ e2 = e;
+ assert(std::strcmp(e2.what(), msg) == 0);
+ }
+ {
+ std::string msg("another domain_error message");
+ std::domain_error e(msg);
+ assert(e.what() == msg);
+ std::domain_error e2(e);
+ assert(e2.what() == msg);
+ e2 = e;
+ assert(e2.what() == msg);
+ }
+}
diff --git a/test/std/diagnostics/std.exceptions/invalid.argument/invalid_argument.pass.cpp b/test/std/diagnostics/std.exceptions/invalid.argument/invalid_argument.pass.cpp
new file mode 100644
index 0000000000000..e360275a6835e
--- /dev/null
+++ b/test/std/diagnostics/std.exceptions/invalid.argument/invalid_argument.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.
+//
+//===----------------------------------------------------------------------===//
+
+// test invalid_argument
+
+#include <stdexcept>
+#include <type_traits>
+#include <cstring>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ static_assert((std::is_base_of<std::logic_error, std::invalid_argument>::value),
+ "std::is_base_of<std::logic_error, std::invalid_argument>::value");
+ static_assert(std::is_polymorphic<std::invalid_argument>::value,
+ "std::is_polymorphic<std::invalid_argument>::value");
+ {
+ const char* msg = "invalid_argument message";
+ std::invalid_argument e(msg);
+ assert(std::strcmp(e.what(), msg) == 0);
+ std::invalid_argument e2(e);
+ assert(std::strcmp(e2.what(), msg) == 0);
+ e2 = e;
+ assert(std::strcmp(e2.what(), msg) == 0);
+ }
+ {
+ std::string msg("another invalid_argument message");
+ std::invalid_argument e(msg);
+ assert(e.what() == msg);
+ std::invalid_argument e2(e);
+ assert(e2.what() == msg);
+ e2 = e;
+ assert(e2.what() == msg);
+ }
+}
diff --git a/test/std/diagnostics/std.exceptions/length.error/length_error.pass.cpp b/test/std/diagnostics/std.exceptions/length.error/length_error.pass.cpp
new file mode 100644
index 0000000000000..3a9144121a0c6
--- /dev/null
+++ b/test/std/diagnostics/std.exceptions/length.error/length_error.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.
+//
+//===----------------------------------------------------------------------===//
+
+// test length_error
+
+#include <stdexcept>
+#include <type_traits>
+#include <cstring>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ static_assert((std::is_base_of<std::logic_error, std::length_error>::value),
+ "std::is_base_of<std::logic_error, std::length_error>::value");
+ static_assert(std::is_polymorphic<std::length_error>::value,
+ "std::is_polymorphic<std::length_error>::value");
+ {
+ const char* msg = "length_error message";
+ std::length_error e(msg);
+ assert(std::strcmp(e.what(), msg) == 0);
+ std::length_error e2(e);
+ assert(std::strcmp(e2.what(), msg) == 0);
+ e2 = e;
+ assert(std::strcmp(e2.what(), msg) == 0);
+ }
+ {
+ std::string msg("another length_error message");
+ std::length_error e(msg);
+ assert(e.what() == msg);
+ std::length_error e2(e);
+ assert(e2.what() == msg);
+ e2 = e;
+ assert(e2.what() == msg);
+ }
+}
diff --git a/test/std/diagnostics/std.exceptions/logic.error/logic_error.pass.cpp b/test/std/diagnostics/std.exceptions/logic.error/logic_error.pass.cpp
new file mode 100644
index 0000000000000..3c3d4f4f97110
--- /dev/null
+++ b/test/std/diagnostics/std.exceptions/logic.error/logic_error.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.
+//
+//===----------------------------------------------------------------------===//
+
+// test logic_error
+
+#include <stdexcept>
+#include <type_traits>
+#include <cstring>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ static_assert((std::is_base_of<std::exception, std::logic_error>::value),
+ "std::is_base_of<std::exception, std::logic_error>::value");
+ static_assert(std::is_polymorphic<std::logic_error>::value,
+ "std::is_polymorphic<std::logic_error>::value");
+ {
+ const char* msg = "logic_error message";
+ std::logic_error e(msg);
+ assert(std::strcmp(e.what(), msg) == 0);
+ std::logic_error e2(e);
+ assert(std::strcmp(e2.what(), msg) == 0);
+ e2 = e;
+ assert(std::strcmp(e2.what(), msg) == 0);
+ }
+ {
+ std::string msg("another logic_error message");
+ std::logic_error e(msg);
+ assert(e.what() == msg);
+ std::logic_error e2(e);
+ assert(e2.what() == msg);
+ e2 = e;
+ assert(e2.what() == msg);
+ }
+}
diff --git a/test/std/diagnostics/std.exceptions/out.of.range/out_of_range.pass.cpp b/test/std/diagnostics/std.exceptions/out.of.range/out_of_range.pass.cpp
new file mode 100644
index 0000000000000..f358d2b76521f
--- /dev/null
+++ b/test/std/diagnostics/std.exceptions/out.of.range/out_of_range.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.
+//
+//===----------------------------------------------------------------------===//
+
+// test out_of_range
+
+#include <stdexcept>
+#include <type_traits>
+#include <cstring>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ static_assert((std::is_base_of<std::logic_error, std::out_of_range>::value),
+ "std::is_base_of<std::logic_error, std::out_of_range>::value");
+ static_assert(std::is_polymorphic<std::out_of_range>::value,
+ "std::is_polymorphic<std::out_of_range>::value");
+ {
+ const char* msg = "out_of_range message";
+ std::out_of_range e(msg);
+ assert(std::strcmp(e.what(), msg) == 0);
+ std::out_of_range e2(e);
+ assert(std::strcmp(e2.what(), msg) == 0);
+ e2 = e;
+ assert(std::strcmp(e2.what(), msg) == 0);
+ }
+ {
+ std::string msg("another out_of_range message");
+ std::out_of_range e(msg);
+ assert(e.what() == msg);
+ std::out_of_range e2(e);
+ assert(e2.what() == msg);
+ e2 = e;
+ assert(e2.what() == msg);
+ }
+}
diff --git a/test/std/diagnostics/std.exceptions/overflow.error/overflow_error.pass.cpp b/test/std/diagnostics/std.exceptions/overflow.error/overflow_error.pass.cpp
new file mode 100644
index 0000000000000..47f75eb0f3966
--- /dev/null
+++ b/test/std/diagnostics/std.exceptions/overflow.error/overflow_error.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.
+//
+//===----------------------------------------------------------------------===//
+
+// test overflow_error
+
+#include <stdexcept>
+#include <type_traits>
+#include <cstring>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ static_assert((std::is_base_of<std::runtime_error, std::overflow_error>::value),
+ "std::is_base_of<std::runtime_error, std::overflow_error>::value");
+ static_assert(std::is_polymorphic<std::overflow_error>::value,
+ "std::is_polymorphic<std::overflow_error>::value");
+ {
+ const char* msg = "overflow_error message";
+ std::overflow_error e(msg);
+ assert(std::strcmp(e.what(), msg) == 0);
+ std::overflow_error e2(e);
+ assert(std::strcmp(e2.what(), msg) == 0);
+ e2 = e;
+ assert(std::strcmp(e2.what(), msg) == 0);
+ }
+ {
+ std::string msg("another overflow_error message");
+ std::overflow_error e(msg);
+ assert(e.what() == msg);
+ std::overflow_error e2(e);
+ assert(e2.what() == msg);
+ e2 = e;
+ assert(e2.what() == msg);
+ }
+}
diff --git a/test/std/diagnostics/std.exceptions/range.error/range_error.pass.cpp b/test/std/diagnostics/std.exceptions/range.error/range_error.pass.cpp
new file mode 100644
index 0000000000000..8c82a918921b4
--- /dev/null
+++ b/test/std/diagnostics/std.exceptions/range.error/range_error.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.
+//
+//===----------------------------------------------------------------------===//
+
+// test range_error
+
+#include <stdexcept>
+#include <type_traits>
+#include <cstring>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ static_assert((std::is_base_of<std::runtime_error, std::range_error>::value),
+ "std::is_base_of<std::runtime_error, std::range_error>::value");
+ static_assert(std::is_polymorphic<std::range_error>::value,
+ "std::is_polymorphic<std::range_error>::value");
+ {
+ const char* msg = "range_error message";
+ std::range_error e(msg);
+ assert(std::strcmp(e.what(), msg) == 0);
+ std::range_error e2(e);
+ assert(std::strcmp(e2.what(), msg) == 0);
+ e2 = e;
+ assert(std::strcmp(e2.what(), msg) == 0);
+ }
+ {
+ std::string msg("another range_error message");
+ std::range_error e(msg);
+ assert(e.what() == msg);
+ std::range_error e2(e);
+ assert(e2.what() == msg);
+ e2 = e;
+ assert(e2.what() == msg);
+ }
+}
diff --git a/test/std/diagnostics/std.exceptions/runtime.error/runtime_error.pass.cpp b/test/std/diagnostics/std.exceptions/runtime.error/runtime_error.pass.cpp
new file mode 100644
index 0000000000000..2b2fe20c6628f
--- /dev/null
+++ b/test/std/diagnostics/std.exceptions/runtime.error/runtime_error.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.
+//
+//===----------------------------------------------------------------------===//
+
+// test runtime_error
+
+#include <stdexcept>
+#include <type_traits>
+#include <cstring>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ static_assert((std::is_base_of<std::exception, std::runtime_error>::value),
+ "std::is_base_of<std::exception, std::runtime_error>::value");
+ static_assert(std::is_polymorphic<std::runtime_error>::value,
+ "std::is_polymorphic<std::runtime_error>::value");
+ {
+ const char* msg = "runtime_error message";
+ std::runtime_error e(msg);
+ assert(std::strcmp(e.what(), msg) == 0);
+ std::runtime_error e2(e);
+ assert(std::strcmp(e2.what(), msg) == 0);
+ e2 = e;
+ assert(std::strcmp(e2.what(), msg) == 0);
+ }
+ {
+ std::string msg("another runtime_error message");
+ std::runtime_error e(msg);
+ assert(e.what() == msg);
+ std::runtime_error e2(e);
+ assert(e2.what() == msg);
+ e2 = e;
+ assert(e2.what() == msg);
+ }
+}
diff --git a/test/std/diagnostics/std.exceptions/underflow.error/underflow_error.pass.cpp b/test/std/diagnostics/std.exceptions/underflow.error/underflow_error.pass.cpp
new file mode 100644
index 0000000000000..103c290ac40c8
--- /dev/null
+++ b/test/std/diagnostics/std.exceptions/underflow.error/underflow_error.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.
+//
+//===----------------------------------------------------------------------===//
+
+// test underflow_error
+
+#include <stdexcept>
+#include <type_traits>
+#include <cstring>
+#include <string>
+#include <cassert>
+
+int main()
+{
+ static_assert((std::is_base_of<std::runtime_error, std::underflow_error>::value),
+ "std::is_base_of<std::runtime_error, std::underflow_error>::value");
+ static_assert(std::is_polymorphic<std::underflow_error>::value,
+ "std::is_polymorphic<std::underflow_error>::value");
+ {
+ const char* msg = "underflow_error message";
+ std::underflow_error e(msg);
+ assert(std::strcmp(e.what(), msg) == 0);
+ std::underflow_error e2(e);
+ assert(std::strcmp(e2.what(), msg) == 0);
+ e2 = e;
+ assert(std::strcmp(e2.what(), msg) == 0);
+ }
+ {
+ std::string msg("another underflow_error message");
+ std::underflow_error e(msg);
+ assert(e.what() == msg);
+ std::underflow_error e2(e);
+ assert(e2.what() == msg);
+ e2 = e;
+ assert(e2.what() == msg);
+ }
+}
diff --git a/test/std/diagnostics/std.exceptions/version.pass.cpp b/test/std/diagnostics/std.exceptions/version.pass.cpp
new file mode 100644
index 0000000000000..d9ab009a4365f
--- /dev/null
+++ b/test/std/diagnostics/std.exceptions/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <stdexcept>
+
+#include <stdexcept>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/diagnostics/syserr/errc.pass.cpp b/test/std/diagnostics/syserr/errc.pass.cpp
new file mode 100644
index 0000000000000..247e10bf8d6bc
--- /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 0000000000000..e2e7aeda822b6
--- /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 0000000000000..b58f5c55b643a
--- /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 0000000000000..82770fb438b1f
--- /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 0000000000000..0573ef862efd7
--- /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 0000000000000..bec5e630aecf7
--- /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 0000000000000..707604e486a4c
--- /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 0000000000000..e74458f3fbb69
--- /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 0000000000000..972299936ddf0
--- /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 0000000000000..b5cb18ad76531
--- /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 0000000000000..2353058783902
--- /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 0000000000000..dd51827128b1e
--- /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 0000000000000..d26541d943f32
--- /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 0000000000000..d7cf844dffe4c
--- /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 0000000000000..b58f5c55b643a
--- /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 0000000000000..0100b1c77724e
--- /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 0000000000000..569681b751e8a
--- /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 0000000000000..56489bb71b17f
--- /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 0000000000000..6c073c9fd151d
--- /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 0000000000000..967692a4f1dc4
--- /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 0000000000000..83faa03d28fa7
--- /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 0000000000000..01abc42b3ea96
--- /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 0000000000000..fc4e0f2b25eb9
--- /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 0000000000000..09c87e5cea1cb
--- /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 0000000000000..0b20024013fc4
--- /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 0000000000000..f2e50cf65ce14
--- /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 0000000000000..0a67cd5db6ad7
--- /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 0000000000000..530f42ca9b891
--- /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 0000000000000..1047b7d4213e1
--- /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 0000000000000..b58f5c55b643a
--- /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 0000000000000..b58f5c55b643a
--- /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 0000000000000..fbc03f1aa0291
--- /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 0000000000000..a430ee2f7d82d
--- /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 0000000000000..f3b9eada7651b
--- /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 0000000000000..3773872c7e39f
--- /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 0000000000000..8fcfcc3603a5b
--- /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 0000000000000..509a8b9811877
--- /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 0000000000000..7ab063853d9d4
--- /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 0000000000000..acefc4655abf9
--- /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 0000000000000..edeca06d38b5c
--- /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 0000000000000..fd3e698566b29
--- /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 0000000000000..6a60f50f410d3
--- /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 0000000000000..c755673126bdd
--- /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 0000000000000..b58f5c55b643a
--- /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 0000000000000..b812e364bbc59
--- /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 0000000000000..b58f5c55b643a
--- /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 0000000000000..c059ba3253c29
--- /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 0000000000000..cd8e3fefbf99f
--- /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 0000000000000..b891a6d973d48
--- /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 0000000000000..acf6387fc24a3
--- /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 0000000000000..4f697016ce150
--- /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 0000000000000..87814b19079b5
--- /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 0000000000000..b58f5c55b643a
--- /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 0000000000000..3851150fdf908
--- /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()
+{
+}