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_condition
12ef843c82SJonathan Wakely 
13ef843c82SJonathan Wakely // template <ErrorCodeEnum E> error_condition& operator=(E e);
14ef843c82SJonathan Wakely 
15ef843c82SJonathan Wakely // Regression test for https://github.com/llvm/llvm-project/issues/57614
16ef843c82SJonathan Wakely 
17ef843c82SJonathan Wakely int make_error_condition; // 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 
23ef843c82SJonathan Wakely #include "test_macros.h"
24ef843c82SJonathan Wakely 
25c1cff4eeSRyan Prichard namespace User {
26ef843c82SJonathan Wakely   enum Err {};
27ef843c82SJonathan Wakely 
28ef843c82SJonathan Wakely   std::error_condition make_error_condition(Err) { return std::error_condition(42, std::generic_category()); }
29ef843c82SJonathan Wakely }
30ef843c82SJonathan Wakely 
31ef843c82SJonathan Wakely template <>
32*5dfdac74SNikolas Klauser struct std::is_error_condition_enum<User::Err> : true_type {};
33ef843c82SJonathan Wakely 
34ef843c82SJonathan Wakely int main(int, char**) {
35ef843c82SJonathan Wakely   std::error_condition e;
36c1cff4eeSRyan Prichard   e = User::Err();
37ef843c82SJonathan Wakely   assert(e.value() == 42);
38ef843c82SJonathan Wakely   assert(e.category() == std::generic_category());
39ef843c82SJonathan Wakely   return 0;
40ef843c82SJonathan Wakely }
41