default_error_condition.pass.cpp 881 B

12345678910111213141516171819202122232425262728
  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. // <system_error>
  9. // class error_category
  10. // virtual error_condition default_error_condition(int ev) const;
  11. #include <system_error>
  12. #include <cassert>
  13. #include "test_macros.h"
  14. int main(int, char**)
  15. {
  16. const std::error_category& e_cat = std::generic_category();
  17. std::error_condition e_cond = e_cat.default_error_condition(static_cast<int>(std::errc::not_a_directory));
  18. assert(e_cond.category() == e_cat);
  19. assert(e_cond.value() == static_cast<int>(std::errc::not_a_directory));
  20. return 0;
  21. }