Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / diagnostics / syserr / is_error_condition_enum.pass.cpp
blobf4d5057948acde677eed7e38dc091778e81ff113
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
11 // <system_error>
13 // template <class T> constexpr bool is_error_condition_enum_v;
15 #include <cstddef>
16 #include <string>
17 #include <system_error>
18 #include <type_traits>
20 #include "test_macros.h"
22 template <bool Expected, class T>
23 void
24 test()
26 static_assert((std::is_error_condition_enum<T>::value == Expected), "");
27 #if TEST_STD_VER > 14
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);
30 #endif
33 class A {
34 A();
35 operator std::error_condition () const { return std::error_condition(); }
38 // Specialize the template for my class
39 template <>
40 struct std::is_error_condition_enum<A> : public std::true_type {};
42 int main(int, char**)
44 test<false, void>();
45 test<false, int>();
46 test<false, std::nullptr_t>();
47 test<false, std::string>();
49 test<true, A>();
51 return 0;