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 // <experimental/filesystem> 13 14 // enum class file_type; 15 16 #include <experimental/filesystem> 17 #include <type_traits> 18 #include <cassert> 19 20 #include "test_macros.h" 21 22 namespace fs = std::experimental::filesystem; 23 24 constexpr fs::file_type ME(int val) { return static_cast<fs::file_type>(val); } 25 26 int main() { 27 typedef fs::file_type E; 28 static_assert(std::is_enum<E>::value, ""); 29 30 // Check that E is a scoped enum by checking for conversions. 31 typedef std::underlying_type<E>::type UT; 32 static_assert(!std::is_convertible<E, UT>::value, ""); 33 34 static_assert(std::is_same<UT, signed char>::value, ""); // Implementation detail 35 36 static_assert( 37 E::none == ME(0) && 38 E::not_found == ME(-1) && 39 E::regular == ME(1) && 40 E::directory == ME(2) && 41 E::symlink == ME(3) && 42 E::block == ME(4) && 43 E::character == ME(5) && 44 E::fifo == ME(6) && 45 E::socket == ME(7) && 46 E::unknown == ME(8), 47 "Expected enumeration values do not match"); 48 } 49