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 // <system_error>
11 
12 // class error_code
13 
14 // template <ErrorCodeEnum E> error_code& operator=(E e);
15 
16 #include <system_error>
17 #include <cassert>
18 
19 enum testing
20 {
21     zero, one, two
22 };
23 
24 namespace std
25 {
26 
27 template <> struct is_error_code_enum<testing> : public std::true_type {};
28 
29 }
30 
31 std::error_code
make_error_code(testing x)32 make_error_code(testing x)
33 {
34     return std::error_code(static_cast<int>(x), std::generic_category());
35 }
36 
main()37 int main()
38 {
39     {
40         std::error_code ec;
41         ec = two;
42         assert(ec.value() == 2);
43         assert(ec.category() == std::generic_category());
44     }
45 }
46