Index: include/experimental/system_error =================================================================== --- /dev/null +++ include/experimental/system_error @@ -0,0 +1,59 @@ +// -*- C++ -*- +//===-------------------------- system_error ------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR +#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR + +/** + experimental/system_error synopsis + +// C++1y + +#include + +namespace std { +namespace experimental { +inline namespace fundamentals_v1 { + + // See C++14 19.5, System error support + template constexpr bool is_error_code_enum_v + = is_error_code_enum::value; + template constexpr bool is_error_condition_enum_v + = is_error_condition_enum::value; + +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace std + +*/ + +#include + +#if _LIBCPP_STD_VER > 11 + +#include + +_LIBCPP_BEGIN_NAMESPACE_LFTS + +#if __has_feature(cxx_variable_templates) + +template _LIBCPP_CONSTEXPR bool is_error_code_enum_v + = is_error_code_enum<_Tp>::value; + +template _LIBCPP_CONSTEXPR bool is_error_condition_enum_v + = is_error_condition_enum<_Tp>::value; + +#endif /* __has_feature(cxx_variable_templates) */ + +_LIBCPP_END_NAMESPACE_LFTS + +#endif /* _LIBCPP_STD_VER > 11 */ + +#endif /* _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR */ \ No newline at end of file Index: test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp =================================================================== --- /dev/null +++ test/libcxx/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#ifndef _LIBCPP_STD_VER > 11 +# ifndef _LIBCPP_SYSTEM_ERROR +# error " must include " +# endif +#endif + +int main() +{ +} Index: test/libcxx/experimental/utilities/syserror/version.pass.cpp =================================================================== --- /dev/null +++ test/libcxx/experimental/utilities/syserror/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. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} Index: test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp =================================================================== --- /dev/null +++ test/std/experimental/utilities/syserror/header.system_error.synop/includes.pass.cpp @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +#include + +int main() +{ + // Check that has been included + std::error_code ec; + ((void)ec); +} Index: test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp =================================================================== --- /dev/null +++ test/std/experimental/utilities/syserror/header.system_error.synop/is_error_code_enum_v.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template constexpr bool is_error_code_enum_v; + +#include +#include /* for std::io_errc */ + +namespace ex = std::experimental; + +int main() { + { + static_assert(ex::is_error_code_enum_v, ""); + + static_assert(ex::is_error_code_enum_v == + std::is_error_code_enum::value, ""); + + static_assert(std::is_same), + const bool>::value, ""); + } + { + static_assert(!ex::is_error_code_enum_v, ""); + + static_assert(ex::is_error_code_enum_v == + std::is_error_code_enum::value, ""); + } +} Index: test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp =================================================================== --- /dev/null +++ test/std/experimental/utilities/syserror/header.system_error.synop/is_error_condition_enum.pass.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template constexpr bool is_error_condition_enum_v; + +#include +#include +namespace ex = std::experimental; + +int main() { + { + static_assert(ex::is_error_condition_enum_v, ""); + + static_assert(ex::is_error_condition_enum_v == + std::is_error_condition_enum::value, ""); + + static_assert( + std::is_same), + const bool>::value, + ""); + } + { + static_assert(!ex::is_error_condition_enum_v, ""); + + static_assert(ex::is_error_condition_enum_v == + std::is_error_condition_enum::value, ""); + } +}