1ef843c82SJonathan Wakely //===----------------------------------------------------------------------===// 2ef843c82SJonathan Wakely // 3ef843c82SJonathan Wakely // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4ef843c82SJonathan Wakely // See https://llvm.org/LICENSE.txt for license information. 5ef843c82SJonathan Wakely // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6ef843c82SJonathan Wakely // 7ef843c82SJonathan Wakely //===----------------------------------------------------------------------===// 8ef843c82SJonathan Wakely 9ef843c82SJonathan Wakely // <system_error> 10ef843c82SJonathan Wakely 11ef843c82SJonathan Wakely // class error_code 12ef843c82SJonathan Wakely 13ef843c82SJonathan Wakely // template <ErrorCodeEnum E> error_code(E e); 14ef843c82SJonathan Wakely 15ef843c82SJonathan Wakely // Regression test for https://github.com/llvm/llvm-project/issues/57614 16ef843c82SJonathan Wakely 17ef843c82SJonathan Wakely int make_error_code; // It's important that this comes before <system_error> 18ef843c82SJonathan Wakely 19ef843c82SJonathan Wakely #include <system_error> 20ef843c82SJonathan Wakely #include <cassert> 21ef843c82SJonathan Wakely #include <type_traits> 22ef843c82SJonathan Wakely 23c1cff4eeSRyan Prichard namespace User { 24ef843c82SJonathan Wakely enum Err {}; 25ef843c82SJonathan Wakely 26ef843c82SJonathan Wakely std::error_code make_error_code(Err) { return std::error_code(42, std::generic_category()); } 27ef843c82SJonathan Wakely } 28ef843c82SJonathan Wakely 29ef843c82SJonathan Wakely template <> 30*5dfdac74SNikolas Klauser struct std::is_error_code_enum<User::Err> : true_type {}; 31ef843c82SJonathan Wakely 32ef843c82SJonathan Wakely int main(int, char**) { 33c1cff4eeSRyan Prichard std::error_code e((User::Err())); 34ef843c82SJonathan Wakely assert(e.value() == 42); 35ef843c82SJonathan Wakely assert(e.category() == std::generic_category()); 36ef843c82SJonathan Wakely 37ef843c82SJonathan Wakely return 0; 38ef843c82SJonathan Wakely } 39