26 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// REQUIRES: windows10 11// Validate that system_error on windows accepts Windows' System Error Codes (as12// used by win32 APIs and reported by GetLastError), and that they are properly13// translated to generic conditions.14 15#include <windows.h>16#include <system_error>17#include <cassert>18 19#include "test_macros.h"20 21int main(int, char**) {22 LIBCPP_ASSERT(std::error_code(ERROR_ACCESS_DENIED, std::system_category()) == std::errc::permission_denied);23 LIBCPP_ASSERT(std::error_code(ERROR_PATH_NOT_FOUND, std::system_category()) == std::errc::no_such_file_or_directory);24 return 0;25}26