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