libcxx initial import
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103490 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
24
test/diagnostics/assertions/cassert.pass.cpp
Normal file
24
test/diagnostics/assertions/cassert.pass.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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()
|
||||
{
|
||||
}
|
12
test/diagnostics/diagnostics.general/nothing_to_do.pass.cpp
Normal file
12
test/diagnostics/diagnostics.general/nothing_to_do.pass.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
341
test/diagnostics/errno/cerrno.pass.cpp
Normal file
341
test/diagnostics/errno/cerrno.pass.cpp
Normal file
@@ -0,0 +1,341 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- algorithm ---------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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
|
||||
|
||||
#ifndef ENODATA
|
||||
#error ENODATA not defined
|
||||
#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
|
||||
|
||||
#ifndef ENOSR
|
||||
#error ENOSR not defined
|
||||
#endif
|
||||
|
||||
#ifndef ENOSTR
|
||||
#error ENOSTR not defined
|
||||
#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
|
||||
|
||||
#ifndef ETIME
|
||||
#error ETIME not defined
|
||||
#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()
|
||||
{
|
||||
}
|
12
test/diagnostics/nothing_to_do.pass.cpp
Normal file
12
test/diagnostics/nothing_to_do.pass.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
20
test/diagnostics/std.exceptions/version.pass.cpp
Normal file
20
test/diagnostics/std.exceptions/version.pass.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <stdexcept>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#ifndef _LIBCPP_VERSION
|
||||
#error _LIBCPP_VERSION not defined
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
96
test/diagnostics/syserr/errc.pass.cpp
Normal file
96
test/diagnostics/syserr/errc.pass.cpp
Normal file
@@ -0,0 +1,96 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <system_error>
|
||||
|
||||
// enum errc {...}
|
||||
|
||||
#include <system_error>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(std::errc::address_family_not_supported == EAFNOSUPPORT, "");
|
||||
static_assert(std::errc::address_in_use == EADDRINUSE, "");
|
||||
static_assert(std::errc::address_not_available == EADDRNOTAVAIL, "");
|
||||
static_assert(std::errc::already_connected == EISCONN, "");
|
||||
static_assert(std::errc::argument_list_too_long == E2BIG, "");
|
||||
static_assert(std::errc::argument_out_of_domain == EDOM, "");
|
||||
static_assert(std::errc::bad_address == EFAULT, "");
|
||||
static_assert(std::errc::bad_file_descriptor == EBADF, "");
|
||||
static_assert(std::errc::bad_message == EBADMSG, "");
|
||||
static_assert(std::errc::broken_pipe == EPIPE, "");
|
||||
static_assert(std::errc::connection_aborted == ECONNABORTED, "");
|
||||
static_assert(std::errc::connection_already_in_progress == EALREADY, "");
|
||||
static_assert(std::errc::connection_refused == ECONNREFUSED, "");
|
||||
static_assert(std::errc::connection_reset == ECONNRESET, "");
|
||||
static_assert(std::errc::cross_device_link == EXDEV, "");
|
||||
static_assert(std::errc::destination_address_required == EDESTADDRREQ, "");
|
||||
static_assert(std::errc::device_or_resource_busy == EBUSY, "");
|
||||
static_assert(std::errc::directory_not_empty == ENOTEMPTY, "");
|
||||
static_assert(std::errc::executable_format_error == ENOEXEC, "");
|
||||
static_assert(std::errc::file_exists == EEXIST, "");
|
||||
static_assert(std::errc::file_too_large == EFBIG, "");
|
||||
static_assert(std::errc::filename_too_long == ENAMETOOLONG, "");
|
||||
static_assert(std::errc::function_not_supported == ENOSYS, "");
|
||||
static_assert(std::errc::host_unreachable == EHOSTUNREACH, "");
|
||||
static_assert(std::errc::identifier_removed == EIDRM, "");
|
||||
static_assert(std::errc::illegal_byte_sequence == EILSEQ, "");
|
||||
static_assert(std::errc::inappropriate_io_control_operation == ENOTTY, "");
|
||||
static_assert(std::errc::interrupted == EINTR, "");
|
||||
static_assert(std::errc::invalid_argument == EINVAL, "");
|
||||
static_assert(std::errc::invalid_seek == ESPIPE, "");
|
||||
static_assert(std::errc::io_error == EIO, "");
|
||||
static_assert(std::errc::is_a_directory == EISDIR, "");
|
||||
static_assert(std::errc::message_size == EMSGSIZE, "");
|
||||
static_assert(std::errc::network_down == ENETDOWN, "");
|
||||
static_assert(std::errc::network_reset == ENETRESET, "");
|
||||
static_assert(std::errc::network_unreachable == ENETUNREACH, "");
|
||||
static_assert(std::errc::no_buffer_space == ENOBUFS, "");
|
||||
static_assert(std::errc::no_child_process == ECHILD, "");
|
||||
static_assert(std::errc::no_link == ENOLINK, "");
|
||||
static_assert(std::errc::no_lock_available == ENOLCK, "");
|
||||
static_assert(std::errc::no_message_available == ENODATA, "");
|
||||
static_assert(std::errc::no_message == ENOMSG, "");
|
||||
static_assert(std::errc::no_protocol_option == ENOPROTOOPT, "");
|
||||
static_assert(std::errc::no_space_on_device == ENOSPC, "");
|
||||
static_assert(std::errc::no_stream_resources == ENOSR, "");
|
||||
static_assert(std::errc::no_such_device_or_address == ENXIO, "");
|
||||
static_assert(std::errc::no_such_device == ENODEV, "");
|
||||
static_assert(std::errc::no_such_file_or_directory == ENOENT, "");
|
||||
static_assert(std::errc::no_such_process == ESRCH, "");
|
||||
static_assert(std::errc::not_a_directory == ENOTDIR, "");
|
||||
static_assert(std::errc::not_a_socket == ENOTSOCK, "");
|
||||
static_assert(std::errc::not_a_stream == ENOSTR, "");
|
||||
static_assert(std::errc::not_connected == ENOTCONN, "");
|
||||
static_assert(std::errc::not_enough_memory == ENOMEM, "");
|
||||
static_assert(std::errc::not_supported == ENOTSUP, "");
|
||||
static_assert(std::errc::operation_canceled == ECANCELED, "");
|
||||
static_assert(std::errc::operation_in_progress == EINPROGRESS, "");
|
||||
static_assert(std::errc::operation_not_permitted == EPERM, "");
|
||||
static_assert(std::errc::operation_not_supported == EOPNOTSUPP, "");
|
||||
static_assert(std::errc::operation_would_block == EWOULDBLOCK, "");
|
||||
static_assert(std::errc::owner_dead == EOWNERDEAD, "");
|
||||
static_assert(std::errc::permission_denied == EACCES, "");
|
||||
static_assert(std::errc::protocol_error == EPROTO, "");
|
||||
static_assert(std::errc::protocol_not_supported == EPROTONOSUPPORT, "");
|
||||
static_assert(std::errc::read_only_file_system == EROFS, "");
|
||||
static_assert(std::errc::resource_deadlock_would_occur == EDEADLK, "");
|
||||
static_assert(std::errc::resource_unavailable_try_again == EAGAIN, "");
|
||||
static_assert(std::errc::result_out_of_range == ERANGE, "");
|
||||
static_assert(std::errc::state_not_recoverable == ENOTRECOVERABLE, "");
|
||||
static_assert(std::errc::stream_timeout == ETIME, "");
|
||||
static_assert(std::errc::text_file_busy == ETXTBSY, "");
|
||||
static_assert(std::errc::timed_out == ETIMEDOUT, "");
|
||||
static_assert(std::errc::too_many_files_open_in_system == ENFILE, "");
|
||||
static_assert(std::errc::too_many_files_open == EMFILE, "");
|
||||
static_assert(std::errc::too_many_links == EMLINK, "");
|
||||
static_assert(std::errc::too_many_symbolic_link_levels == ELOOP, "");
|
||||
static_assert(std::errc::value_too_large == EOVERFLOW, "");
|
||||
static_assert(std::errc::wrong_protocol_type == EPROTOTYPE, "");
|
||||
}
|
@@ -0,0 +1,106 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
12
test/diagnostics/syserr/syserr.errcat/nothing_to_do.pass.cpp
Normal file
12
test/diagnostics/syserr/syserr.errcat/nothing_to_do.pass.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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));
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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));
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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");
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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(500);
|
||||
assert(e_cond.value() == 500);
|
||||
assert(e_cond.category() == std::system_category());
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <system_error>
|
||||
|
||||
// class error_category
|
||||
|
||||
#include <system_error>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::error_category* p = 0;
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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(std::errc::not_a_directory);
|
||||
assert(e_cond.category() == e_cat);
|
||||
assert(e_cond.value() == std::errc::not_a_directory);
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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));
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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));
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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");
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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));
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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));
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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));
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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());
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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));
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
42
test/diagnostics/syserr/syserr.hash/error_code.pass.cpp
Normal file
42
test/diagnostics/syserr/syserr.hash/error_code.pass.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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_base_of<std::unary_function<T, std::size_t>,
|
||||
H>::value), "");
|
||||
H h;
|
||||
T ec(i, std::system_category());
|
||||
assert(h(ec) == i);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test(0);
|
||||
test(2);
|
||||
test(10);
|
||||
}
|
12
test/diagnostics/syserr/syserr.syserr/nothing_to_do.pass.cpp
Normal file
12
test/diagnostics/syserr/syserr.syserr/nothing_to_do.pass.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. 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);
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
20
test/diagnostics/syserr/version.pass.cpp
Normal file
20
test/diagnostics/syserr/version.pass.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <system_error>
|
||||
|
||||
#include <system_error>
|
||||
|
||||
#ifndef _LIBCPP_VERSION
|
||||
#error _LIBCPP_VERSION not defined
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user