brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · efada24 Raw
39 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// <system_error>10 11// class error_condition12 13// template <ErrorCodeEnum E> error_condition(E e);14 15// Regression test for https://llvm.org/PR5761416 17int make_error_condition; // It's important that this comes before <system_error>18 19#include <system_error>20#include <cassert>21#include <type_traits>22 23namespace User {24  enum Err {};25 26  std::error_condition make_error_condition(Err) { return std::error_condition(42, std::generic_category()); }27}28 29template <>30struct std::is_error_condition_enum<User::Err> : true_type {};31 32int main(int, char**) {33  std::error_condition e((User::Err()));34  assert(e.value() == 42);35  assert(e.category() == std::generic_category());36 37  return 0;38}39