xref: /llvm-project/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp (revision 998a5c88312066fcc2b2de1358edc76587611354)
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 // class path;
15 // enum class format;
16 
17 #include "filesystem_include.hpp"
18 #include <type_traits>
19 #include <cassert>
20 
21 #include "test_macros.h"
22 
23 int main() {
24   typedef fs::path::format E;
25   static_assert(std::is_enum<E>::value, "");
26 
27   // Check that E is a scoped enum by checking for conversions.
28   typedef std::underlying_type<E>::type UT;
29   static_assert(!std::is_convertible<E, UT>::value, "");
30 
31   LIBCPP_ONLY(static_assert(std::is_same<UT, unsigned char>::value, "")); // Implementation detail
32 
33   static_assert(
34           E::auto_format   != E::native_format &&
35           E::auto_format   != E::generic_format &&
36           E::native_format != E::generic_format,
37         "Expected enumeration values are not unique");
38 }
39