1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // UNSUPPORTED: c++98, c++03 11 12 // <filesystem> 13 14 // enum class perm_options; 15 16 #include "filesystem_include.hpp" 17 #include <type_traits> 18 #include <cassert> 19 #include <sys/stat.h> 20 21 #include "test_macros.h" 22 #include "check_bitmask_types.hpp" 23 24 ME(int val)25constexpr fs::perm_options ME(int val) { 26 return static_cast<fs::perm_options>(val); 27 } 28 main()29int main() { 30 typedef fs::perm_options E; 31 static_assert(std::is_enum<E>::value, ""); 32 33 // Check that E is a scoped enum by checking for conversions. 34 typedef std::underlying_type<E>::type UT; 35 static_assert(!std::is_convertible<E, UT>::value, ""); 36 37 static_assert(std::is_same<UT, unsigned char >::value, ""); // Implementation detail 38 39 typedef check_bitmask_type<E, E::replace, E::nofollow> BitmaskTester; 40 assert(BitmaskTester::check()); 41 42 static_assert( 43 E::replace == ME(1) && 44 E::add == ME(2) && 45 E::remove == ME(4) && 46 E::nofollow == ME(8), 47 "Expected enumeration values do not match"); 48 } 49