default_error_condition.pass.cpp 929 B

123456789101112131415161718192021222324252627282930
  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-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // UNSUPPORTED: libcpp-has-no-threads
  10. // <future>
  11. // const error_category& future_category();
  12. // virtual error_condition default_error_condition(int ev) const;
  13. #include <future>
  14. #include <cassert>
  15. #include "test_macros.h"
  16. int main(int, char**)
  17. {
  18. const std::error_category& e_cat = std::future_category();
  19. std::error_condition e_cond = e_cat.default_error_condition(static_cast<int>(std::errc::not_a_directory));
  20. assert(e_cond.category() == e_cat);
  21. assert(e_cond.value() == static_cast<int>(std::errc::not_a_directory));
  22. return 0;
  23. }