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