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: c++03, c++11, c++14 10 11 // <filesystem> 12 13 // enum class directory_options; 14 15 #include <filesystem> 16 #include <type_traits> 17 #include <cassert> 18 19 #include "test_macros.h" 20 #include "check_bitmask_types.h" 21 namespace fs = std::filesystem; 22 23 constexpr fs::directory_options ME(int val) { return static_cast<fs::directory_options>(val); } 24 25 int main(int, char**) { 26 typedef fs::directory_options E; 27 static_assert(std::is_enum<E>::value, ""); 28 29 // Check that E is a scoped enum by checking for conversions. 30 typedef std::underlying_type<E>::type UT; 31 static_assert(!std::is_convertible<E, UT>::value, ""); 32 LIBCPP_ONLY(static_assert(std::is_same<UT, unsigned char>::value, "")); 33 34 typedef check_bitmask_type<E, E::follow_directory_symlink, E::skip_permission_denied> BitmaskTester; 35 assert(BitmaskTester::check()); 36 37 static_assert( 38 E::none == ME(0) && 39 E::follow_directory_symlink == ME(1) && 40 E::skip_permission_denied == ME(2), 41 "Expected enumeration values do not match"); 42 43 44 return 0; 45 } 46