1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
13 // template <class T> constexpr bool is_error_condition_enum_v;
17 #include <system_error>
18 #include <type_traits>
20 #include "test_macros.h"
22 template <bool Expected
, class T
>
26 static_assert((std::is_error_condition_enum
<T
>::value
== Expected
), "");
28 static_assert((std::is_error_condition_enum_v
<T
> == Expected
), "");
29 ASSERT_SAME_TYPE(decltype(std::is_error_condition_enum_v
<T
>), const bool);
35 operator std::error_condition () const { return std::error_condition(); }
38 // Specialize the template for my class
40 struct std::is_error_condition_enum
<A
> : public std::true_type
{};
46 test
<false, std::nullptr_t
>();
47 test
<false, std::string
>();