1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// UNSUPPORTED: c++03
11
12// <system_error>
13
14// template <> struct is_error_code_enum<> : public false_type {};
15
16#include <system_error>
17#include <string>
18#include "test_macros.h"
19
20template <bool Expected, class T>
21void
22test()
23{
24    static_assert((std::is_error_code_enum<T>::value == Expected), "");
25#if TEST_STD_VER > 14
26    static_assert((std::is_error_code_enum_v<T>      == Expected), "");
27#endif
28}
29
30class A {
31	A();
32	operator std::error_code () const { return std::error_code(); }
33};
34
35// Specialize the template for my class
36namespace std
37{
38  template <>
39  struct is_error_code_enum<A> : public std::true_type {};
40}
41
42
43int main()
44{
45    test<false, void>();
46    test<false, int>();
47    test<false, std::nullptr_t>();
48    test<false, std::string>();
49
50    test<true, A>();
51}
52